<!--
 * @Author: T.Y.Z
 * @Date: 2022-12-03 13:56:29
 * @LastEditTime: 2023-12-27 17:56:15
 * @LastEditors: DESKTOP-4QFD9PO
 * @Description: In User Settings Edit
 * @FilePath: \ClothMes\public\index2.html
-->
<!DOCTYPE html>
<html lang="zh">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0">
    <script src="./vue.js"></script>
    <script src="./static/axios.js"></script>
    <script src="./static/arco.js"></script>
    <script src="./reconnecting-websocket.js"></script>
    <script src="./reconnecting-websocket.min.js"></script>
    <link rel="stylesheet" href="./static/css/arco.css" type="text/css">
    <title>验布</title>
</head>
<style>
    html,
    body {
        height: 100vh;
    }

    .tableBox .arco-table-size-mini .arco-table-cell {
        padding: 0 !important;
    }

    .arco-table-th {
        border-right: 1px solid var(--color-neutral-3);
    }

    .arco-table-td {
        border-right: 1px solid var(--color-neutral-3);
    }

    .arco-select-view-single {
        padding-left: 0;
        padding-right: 0;
    }

    .arco-input-wrapper {
        padding-left: 0;
        padding-right: 0;
    }

    .arco-scrollbar.arco-scrollbar-type-embed .arco-scrollbar-thumb {
        opacity: 1 !important;
    }

    .arco-scrollbar-thumb-bar {
        background-color: rgb(124 124 124) !important
    }

    .arco-overlay {
        transform: scale(3) !important;
        position: fixed;
        z-index: 99999 !important;
        top: 50px;
        left: 40%;
        width: 20%;
    }
</style>

<body>
    <div id="app">
        <!-- v-if= v-if="(pageData.isOpen!=''&&pageData.isOpen!=null&&pageData.isOpen!=undefined)" -->
        <div style="width: 100vw;height: 100vh;"
            v-if="(pageData.isOpen!=''&&pageData.isOpen!=null&&pageData.isOpen!=undefined)">
            <div
                style="position: fixed;top: 0;width: 100vw;background-color: white;border: 1px solid #ccc;height: 33px;padding: 6px 10px 0;">
                <a-button type="outline" status="success" @click="clickType"
                    style="position: absolute;font-size:16px;cursor: default;position: fixed;top: 6px">
                    {{ dataForm.type === 0 ? "初检" : dataForm.type === 1 ? "抽检" : "复检" }}({{ inspectNum }})
                </a-button>
                <!-- <a-button v-if="pageData.buttonShow" type="outline" status="success"
                style="position: absolute;font-size: 20px;cursor: default;position: fixed;top: 0;background-color: #f53f3f;z-index: 9999;">复检
            </a-button> -->
                <!-- <button style="position: absolute; left: 384px;width: 150px;height: 40px;background-color: rgb(23, 93, 255);color: white;font-size: 25px;"
            @click="openPop">{{ pageData.btnText }}
    </button> -->
                <!-- <a-form-item label="" > -->
                <div style="width: 140px;display: inline-block;margin-left: 84px;font-size: 16px;">布飞扫码 <input
                        v-model.lazy="dataForm.form.clothCode" ref="getFocus" :title="dataForm.form.clothCode"
                        @click="dataForm.form.clothCode =''" @change="changeTm" @blur="blurYg"
                        style="display: inline-block;width: 60px;height: 20px;vertical-align: middle;background-color: yellow;" />
                </div>
                <div style="width: 170px;display: inline-block; font-size: 16px;">员工码
                    <input v-model.lazy="ygCodeOb" ref="getFocusCode" :title="ygCodeOb"
                        @keyup.native.enter="changeYg($Event,ygCodeOb)" @blur="blurYg"
                        style="display: inline-block;width: 50px;height: 20px;vertical-align: middle;" />
                    验布员:
                </div>
                <div style="width: 86px;display: inline-block;font-size: 16px;"
                    v-for="(item,index) in pageData.ygCodeList">
                    <input :value="item.empName"
                        style="display: inline-block;width: 50px;height: 20px;vertical-align: middle;" readonly />
                    <img style="width: 25px;height: 28px;vertical-align: middle;" src="./del.png"
                        @click="clickDel(item.empId)" />
                </div>
                <!-- <div style="width:180px;display: inline-block;height: 20px;"  v-if="dataForm.type === 1">班长复检
        <a-select popup-container="html"  v-model="pageData.monitorRetest" style="width: 100px;" size="mini" @focus="getPeopleList(2)">
            <a-option v-for="(item,index) in pageData.monitorRetestList" :value="item.empName">{{item.empName}}</a-option>
        </a-select>
    </div> -->
                <div style="cursor: default;position: absolute;right: 10px;z-index: 1; top: 6px;">
                    <a-button type="primary" @click="fullScreen" style="font-size: 20px;margin-right:20px;" id="fullSn">
                        {{ pageData.textVal }}
                    </a-button>
                    <a-button type="primary" status="success" @click="saveHandler(0)"
                        v-if="pageData['ClothInspectionauthority']['bc']" style="font-size: 20px;margin-right:20px;">
                        保存
                    </a-button>
                    <a-button type="primary" status="warning" @click="saveHandler(1)"
                        v-if="pageData['ClothInspectionauthority']['xb']" style="font-size: 20px;margin-right:20px;"
                        :disabled="isContinueXb">修补
                    </a-button>
                    <a-button type="primary" status="danger" @click="saveHandler(2)" :disabled="isContinueJd"
                        v-if="pageData['ClothInspectionauthority']['jd']" style="font-size: 20px;margin-right:20px;">
                        降等
                    </a-button>
                    <!-- <a-button type="primary" status="danger" @click="delHandler" style="font-size: 20px;"
                    :disabled="!isContinue">删除
                </a-button> -->
                </div>
            </div>
            <div style="height: 42px;"></div>
            <div class="bg-container" style="font-size: 16px;">
                <div v-if="isShow">
                    <!-- <a-form size="mini" :model="dataForm" layout="inline" style="height: 122px;"> -->
                    <div style="width:135px;display: inline-block;height: 23px; ">客&nbsp&nbsp&nbsp户<input
                            v-model="dataForm.form.client" disabled style="width: 75px;transform: translateX(2px);" />
                    </div>
                    <div style="width:180px;display: inline-block;height: 23px;">生产单号 <input
                            v-model="dataForm.form.produceCode" disabled style="width: 100px;" /></div>
                    <div style="width:180px;display: inline-block;height: 23px;">坯布名称 <input
                            :title="dataForm.form.greigeName" v-model="dataForm.form.greigeName" disabled
                            style="width: 100px;" /></div>
                    <div style="width:170px;display: inline-block;height: 23px;">验布等级 <select
                            v-model="dataForm.form.perchingGrade" style="width: 99px;" @focus="focusSel">
                            <option v-for="item in pageData.perchingGradeList" :value="item['verifyclothLevel']">
                                {{ item["verifyclothLevel"] }}
                            </option>
                        </select>
                    </div>
                    <div style="width:170px;display: inline-block;height: 23px;">检验单号 <input
                            v-model="dataForm.form.billNumber" disabled style="width: 90px;" /></div>
                    <div style="width:180px;display: inline-block;height: 23px;">纱&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp批
                        <input v-model="dataForm.form.yarnBatchNumber" disabled
                            style="width: 90px; transform: translateX(-1px)" />
                    </div>
                    <div style="width:135px;display: inline-block;height: 23px; ">机台号<input
                            v-model="dataForm.form.machine" disabled style="width: 75px;" />
                    </div>
                    <div style="width:180px;display: inline-block;height: 23px;">匹&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp号
                        <input v-model="dataForm.form.horses" disabled
                            style="width: 100px; transform: translateX(-1px)" />
                    </div>
                    <div style="width:180px;display: inline-block;height: 23px;">坯布编码 <input
                            v-model="dataForm.form.greigeCode" disabled style="width: 100px;" /></div>
                    <div style="width:170px;display: inline-block;height: 23px;">颜&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp色
                        <input v-model="dataForm.form.colour" disabled style="width: 90px;" />
                    </div>
                    <div style="width:340px;display: inline-block;height: 23px;">检验日期 <input
                            v-model="dataForm.form.billDate" disabled style="width: 260px;" /></div>
                    <div style="width:135px;display: inline-block;height: 23px;">机布号<input disabled
                            v-model="dataForm.form.machineGreyCode" style="width: 75px;" /></div>
                    <div style="width:180px;display: inline-block;height: 23px;">布飞条码 <input disabled
                            v-model="dataForm.form.barCode" style="width: 100px;" />
                    </div>
                    <div style="width:180px;display: inline-block;height: 23px;" @click="assignment()">
                        磅布重量 <input type="number" step="0.01" v-model="dataForm.form.actualWeight"
                            style="background-color: #165DFF;color: white;width: 100px;" readonly /></div>
                    <div style="width:170px;display: inline-block;height: 23px;">
                        重&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp量 <input type="number" step="0.01"
                            v-model="dataForm.form.tempWeight" style="width: 90px;" readonly /></div>
                    <div style="width:170px;display: inline-block;height: 23px;" @click="clickCbZl">次布重量 <input
                            v-model="dataForm.form.timeClothShareWeight" step="0.01"
                            style=" background-color: #f53f3f;color: white;width: 90px;" readonly />
                    </div>
                    <div style="width:170px;display: inline-block;height: 23px;">
                        验后重量 <input v-model="dataForm.form.posteriorWeight" step="0.01"
                            style="width: 90px; background-color: #00b42a;color: white;" readonly /></div><br>

                    <!-- <div style="width:180px;display: inline-block;height: 23px;">流水号 <input
                        v-model="dataForm.form.clothfiyCode" style="width: 112px; " disabled>

                    </input>
                </div> -->


                    <!-- <div style="width:180px;display: inline-block;height: 23px;" v-if="dataForm.type === 1">复检日期 <input
                        v-model="pageData.retestDate" disabled style="width: 100px;" /></div> -->
                    <div style="width:180px;display: inline-block;height: 23px;">是否开幅
                        <input v-model="dataForm.form.openNot" disabled style="width: 100px;" />
                    </div>
                    <div type="primary" style="width: 915px;display: inline-block;height: 23px;">
                        备&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp注
                        <a-select popup-container="html"
                            :style="{width:'800px',backgroundColor:'white',border:'1px solid #767676'}"
                            @focus="getRemark" v-model="dataForm.form.perchingGradeRemarks" size="mini" multiple
                            @change="changessssw">
                            <a-option :value="item['remarkName']" v-for="(item,index) in pageData.remarkList">
                                {{ item['remarkName'] }}
                            </a-option>
                        </a-select>

                    </div>
                    <a-button type="primary" @click="viewHistory" style="font-size: 16px;" size="mini"
                        v-if="pageData['ClothInspectionauthority']['cx']">查看历史
                    </a-button>
                    <a-button type="primary" @click="concatCloth" style="font-size: 16px;margin-left: 5px;" size="mini"
                        v-if="pageData['ClothInspectionauthority']['bb']">驳布
                    </a-button>
                    <!-- </a-form> -->
                </div>

            </div>
            <input type="text" ref="baud" list="baudList" style="display:none;width: 10ch;" onclick="this.value = ''"
                onchange="localStorage.baud = this.value" />
            <div ref="tablediv" style=" box-sizing: border-box;background-color: white;margin-top: 3px;">

                <div
                    style="height: 440px;overflow: auto;border: 1px solid #ccc;width:100%;box-sizing: border-box;overflow: auto;padding: 0 10px 0;">
                    <a-tag v-for="(item, index) of pageData.defectNameList" @click="clickName(item['defectName'],1)"
                        @dblclick="clickName(item['defectName'],2)"
                        :class="{ active: (pageData.defectOb.includes(item['defectName']) || pageData.clickDefectOb.includes(item['defectName'])) }"
                        :key="index"
                        style="margin-left:25px;margin-bottom:20px;height:45px;line-height: 40px;cursor: pointer;width: 100px;font-size: 18px;justify-content: center;background-color: #00B42A;color: white;border-radius: 10px;">
                        {{ item['defectName'] }}
                    </a-tag>
                    <!-- <a-modal v-model:visible="visible" :title="defectName" @cancel="handleCancel"
                     @before-ok="handleBeforeOk" :hide-cancel="true" :draggable="true" :footer="false">
                <span style="color: #165DFF;">点击'+'{{defectName}}疵点个数加一，点击'-'{{defectName}}疵点个数减一</span>
                <div style="height: 500px;overflow: auto;">
                    <div style="background-color:#E8F3FF;color: #165DFF;height: 100px;margin-bottom: 10px;line-height: 100px;text-align: center;font-size: 35px;position: relative;"
                         :default-checked="true" v-for="(item, index) in dataForm.ygNameList" :key="index">
                            <span
                                    style="font-size:80px;font-weight: 700; position: absolute;cursor: pointer;top: -10px;left: 10px;"
                                    @click="clickName(item['checkStaff'], item['checkStaffCode'],1)">+</span>
                        {{ item["checkStaff"]}} {{defectNumberOb[defectName+item["checkStaff"]]==undefined?0:defectNumberOb[defectName+item["checkStaff"]]}}个
                        <span
                                style="font-size: 80px;font-weight: 700; position: absolute;cursor: pointer;top: -10px;right: 10px;"
                                @click="clickName(item['checkStaff'], item['checkStaffCode'],2)">-</span>
                    </div>
                </div>


            </a-modal> -->
                </div>
                <div style="width:100%;" class="tableBox">

                    <div style="width:150px;display: inline-block;height: 20px;">总转数
                        <a-input-number v-model="computedTotalRevolutions" style="width: 100px;" class="input-demo"
                            :min="0" :max="10000000000" size="mini" disabled />
                    </div>
                    <!-- <div style="width:200px;display: inline-block;height: 20px;">交班转数 <a-input-number v-model="dataForm.numberShifts" :disabled="dataForm.scanCodesState==0" style="width: 130px;" @blur="zsBlur" class="input-demo" :min="0" :max="10000000000" size="mini"/></div> -->
                    <div style="width:110px;display: inline-block;height: 20px;">
                        <a-button type="primary" @click="addYg" size="mini" style="margin-right: 5px;"
                            v-if="pageData['ClothInspectionauthority']['zjytj']">添加
                        </a-button>
                        <a-button type="primary" status="danger" @click="delLine" size="mini"
                            v-if="pageData['ClothInspectionauthority']['zjysc']">删除
                        </a-button>
                    </div>
                    <!-- <div style="width:200px;display: inline-block;height: 20px;">坯布状态  <select v-model="dataForm.checkoutState" style="width: 108px;" @focus="focusSel">
            <option :value="0">待修补</option>
            <option :value="1">修补中</option>
            <option :value="2">待降级</option>
            <option :value="3">通过</option>
            </select>
        </div> -->
                    <div style="width:350px;display: inline-block;height: 20px;"
                        v-if="pageData['ClothInspectionauthority']['cbgxk']">
                        <span @click="ruCbc">复检不合格是否入次布仓：
                            <input type="checkbox" ref="cbcCheck" style="margin-right:5px;"
                                @change="changeClothWarehouse" @click="ruCbc"></span>
                        </input><select v-model="pageData.dropDownData1" @focus="focusSel1" style="width: 150px;">
                            <option v-for="item in pageData.getCkList" :value="item['warehouseName']">
                                {{ item["warehouseName"] }}
                            </option>
                        </select>
                    </div>
                    <span style="color: red;">*员工次布重量之和要等于称出的次布重量</span>
                    <div @click="
                    materialProblem.checked=!materialProblem.checked,
                    materialProblem1.checked=!materialProblem.checked"
                        style="width:130px;display: inline-block;height: 20px;cursor: pointer;">
                        <span>原料问题开剪：
                            <input type="checkbox" ref="materialProblem" style="margin-right:5px;"
                                @change="changeClothWarehouse" @click="
                                materialProblem.checked=!materialProblem.checked,
                                materialProblem1.checked=!materialProblem.checked"></span>
                        </input>
                    </div>
                    <div @click="
                    materialProblem1.checked=!materialProblem1.checked,
                    materialProblem.checked=!materialProblem1.checked"
                        style="width:130px;display: inline-block;height: 20px;cursor: pointer;">
                        <span>调机员调机：
                            <input type="checkbox" ref="materialProblem1" style="margin-right:5px;"
                                @change="changeClothWarehouse" @click="
                                materialProblem1.checked=!materialProblem1.checked,
                                materialProblem.checked=!materialProblem1.checked"></span>
                        </input>
                    </div>
                    <div style="width:100%;overflow: auto;">
                        <div
                            style="height: 150px;overflow: auto;display: inline-block;width: 45%;margin-top: 5px;min-width: 480px !important;overflow: auto;">
                            <a-table stripe :bordered="true" :columns="tableColumnsYg" :row-selection="{ type:'radio'}"
                                v-model:selected-keys="selectedRowKeysYg" :loading="table.tableLoading"
                                :data="dataForm.yg" row-key="ybRowIndex" size="mini" :pagination="false">
                                <template #zjzssss="{ record }">
                                    <a-input-number v-model="record.checkRevolution" class="input-demo bacClass"
                                        style="background-color: rgb(232, 243, 255);" :min="0" :setup="0.01"
                                        :max="100000000000000" :precision="0" @change="zjzsChange(record)" />
                                </template>
                                <template #bczzzz="{ record }">
                                    <a-select popup-container="html" v-model="record.shift"
                                        style="background-color: rgb(232, 243, 255);">
                                        <a-option value="0">白班</a-option>
                                        <a-option value="1">晚班</a-option>
                                    </a-select>
                                </template>
                                <template #dddd="{ record }">
                                    <a-input-number v-model="record.fabricWeight" class="input-demo" setup="4"
                                        style="background-color: rgb(232, 243, 255);" :min="0" :setup="1"
                                        :max="record.checkWeight" :precision="pageData.decimalNum"
                                        @focus="focusOfCB(record)" @change="changeHcb(record,record.fabricWeight)" />
                                </template>
                                <template #refuteclothstate="{ record }">
                                    <span> {{record.refuteClothState===1?'是':'否'}}</span>
                                </template>

                            </a-table>
                        </div>
                        <div
                            style="height: 150px;display: inline-block;width: 53%;vertical-align: top;margin-top: 5px;min-width: 530px !important;overflow: auto;">
                            <a-table stripe :bordered="true" :columns="tableColumnsCk" v-model:selected-keys="s"
                                :loading="table.tableLoading" :data="dataForm.ckList" :rowKey="id" size="mini"
                                :pagination="false">
                                <template #cccc="{ record }">
                                    <div style="width:100%">
                                        <a-input-number v-model="record.buttonMeterNum" class="input-demo bacClass"
                                            style="background-color: rgb(232, 243, 255);" :min="0"
                                            :max="100000000000000" />
                                    </div>
                                </template>
                                <template #dddd="{ record }">
                                    <div style="width:100%">
                                        <a-input-number v-model="record.defectNumber" class="input-demo bacClass"
                                            style="background-color: rgb(232, 243, 255);" :min="0"
                                            :max="100000000000000" />
                                    </div>
                                </template>
                                <template #bbbb="{ record }">
                                    <div style="width:100%">
                                        <a-input-number v-model="record.buttonMinuteNum" class="input-demo bacClass"
                                            style="background-color: rgb(232, 243, 255);" :min="0"
                                            :max="10000000000000" />
                                    </div>
                                </template>
                                <template #aaaa="{ record }">
                                    <div style="width:100%">
                                        <a-input v-model="record.defectPlace"
                                            style="background-color: rgb(232, 243, 255);" class="bacClass" />

                                    </div>
                                </template>
                                <template #wwwwww="{ record }">
                                    <div style="width:100%">
                                        <img style="width: 25px;height: 28px;" src="./del.png"
                                            @click="clickDeleteRow(record)" />

                                    </div>
                                </template>
                            </a-table>
                        </div>
                    </div>

                </div>

            </div>

            <a-drawer cancel-text='关闭' :mask-closable="false" unmount-on-close @cancel="pageData.showAdd=false"
                style="z-index: 2;" :height="700" :width="400" :visible="pageData.showAdd" placement="bottom"
                @ok="sideOk">
                <template #title>
                    {{ pageData.sideTitle }}
                </template>
                <template #footer>
                    <a-button @click="pageData.showAdd=false" size="large">关闭</a-button>
                </template>
                <div>
                    <a-form size="mini" :model="pageData" layout="inline">
                        <a-form-item label="布飞号">
                            <a-input v-model="pageData.clothCode" class="bacClass" @change="lsBfChange"
                                :style="{backgroundColor:'white',border:'1px solid #767676'}" />
                        </a-form-item>
                        <a-form-item label="验布员工">
                            <a-select popup-container="html" v-model="pageData.empName" @focus="getPeopleList(1)"
                                class="bacClass" allow-clear
                                :style="{backgroundColor:'white',border:'1px solid #767676',width:'100px'}">
                                <a-option v-for="(item,index) in pageData.peopleList" :value="item.empName">
                                    {{ item.empName }}
                                </a-option>
                            </a-select>
                        </a-form-item>
                        <a-form-item label="检验单号">
                            <a-input v-model="pageData.billNumber" class="bacClass"
                                :style="{backgroundColor:'white',border:'1px solid #767676'}" />
                        </a-form-item>


                        <a-form-item label="生产单号">
                            <a-input v-model="pageData.produceCode" class="bacClass"
                                :style="{backgroundColor:'white',border:'1px solid #767676'}" />
                        </a-form-item>
                        <a-form-item label="织布单号">
                            <a-input v-model="pageData.planOrderCode" class="bacClass"
                                :style="{backgroundColor:'white',border:'1px solid #767676'}" />
                        </a-form-item>

                        <a-form-item label="检验状态">
                            <a-select popup-container="html" v-model="pageData.recordType" class="bacClass" allow-clear
                                :style="{backgroundColor:'white',border:'1px solid #767676',width:'100px'}">
                                <a-option :value="0">初检</a-option>
                                <a-option :value="1">抽检</a-option>
                                <a-option :value="2">复检</a-option>
                            </a-select>
                        </a-form-item>
                        <a-form-item label="检验日期">
                            <a-range-picker popup-container="html" v-model="pageData.billingDate"
                                :style="{backgroundColor:'white',border:'1px solid #767676'}"
                                style="width: 250px; margin-right: 24px;" class="bacClass" />
                        </a-form-item>
                        <a-form-item>
                            <a-space>
                                <a-button type="primary" @click="cxLine1" size="small"
                                    v-if="pageData['ClothInspectionauthority']['cx']">查询
                                </a-button>
                                <a-button type="primary" @click="dcLine" size="small"
                                    v-if="pageData['ClothInspectionauthority']['dc']">导出
                                </a-button>
                            </a-space>
                        </a-form-item>
                    </a-form>
                    <a-tabs :default-active-key="pageData.keysNum" :lazy-load="false">
                        <a-table stripe :bordered="true" :columns="tableColumns" style="overflow: auto;"
                            v-model:selected-keys="selectedRowKeysCk" :loading="table.tableLoading" :pagination="false"
                            :data="dataForm.dataList" row-key="id" :row-selection="{ showCheckedAll: true, width: 50 }">
                            <template #detailsssss="{ record }">
                                <div style="width:100%">
                                    <a-button type="primary" @click="handleClickXq(record)">详情</a-button>
                                </div>
                            </template>
                            <template #abc="{ record }">
                                <div style="width:100%">
                                    <a-tag checkable color="green" v-if="record['recordType']==0">初检</a-tag>
                                    <a-tag checkable color="arcoblue" v-if="record['recordType']==1">抽检</a-tag>
                                    <a-tag checkable color="orange" v-if="record['recordType']==2">复检</a-tag>
                                </div>
                            </template>
                            <template #checkoutaaaaa="{ record }">
                                <div style="width:100%">
                                    <a-tag checkable color="arcoblue" v-if="record['checkoutState']==1">修补过</a-tag>
                                    <a-tag checkable color="green" v-if="record['checkoutState']==0">无需修补</a-tag>
                                </div>
                            </template>
                            <template #completeaaaaa="{ record }">
                                <div style="width:100%">
                                    <a-tag checkable color="orangered" v-if="record['completeState']==0">未完成</a-tag>
                                    <a-tag checkable color="orange" v-if="record['completeState']==1">修补中</a-tag>
                                    <a-tag checkable color="orange" v-if="record['completeState']==2">降等中</a-tag>
                                    <a-tag checkable color="green" v-if="record['completeState']==3">已通过</a-tag>
                                    <a-tag checkable color="red" v-if="record['completeState']==4">不合格</a-tag>
                                </div>
                            </template>
                        </a-table>
                    </a-tabs>
                    <a-pagination :total="total" show-total show-jumper show-page-size @change="PageSize"
                        @page-size-change="change1" style="justify-content: center" :page-size="size" :current="page" />
                </div>
            </a-drawer>
            <a-modal v-model:visible="visibleXq" @ok="handleOkXq" @cancel="handleCancelXq" :width="800" draggable
                :height="600">
                <template #title>
                    详情
                </template>
                <a-tabs :lazy-load="true">
                    <a-tab-pane :key="1" title="值机详情">

                        <a-table stripe :bordered="true" :columns="tableColumnsJhd" :pagination="false"
                            :loading="table.tableLoading" :data="pageData.zjData" size="mini">
                            <template #shift="{ record }">
                                {{ record.shift == 0 ? '白班' : '晚班' }}
                            </template>
                        </a-table>
                    </a-tab-pane>

                    <a-tab-pane :key="2" title="疵点信息">
                        <a-table stripe :bordered="true" :columns="tableColumnsCd" :pagination="false"
                            :loading="table.tableLoading" :data="pageData.cjData" size="mini">
                            <template #pppp="{ record }">

                            </template>

                        </a-table>
                    </a-tab-pane>

                    <!-- <a-tab-pane :key="3" title="复检疵点信息">
                    <a-table stripe :bordered="true" :columns="tableColumnsCd" :pagination="false"
                        :loading="table.tableLoading" :data="pageData.fjData" size="mini">
                        <template #pppp="{ record }">

                        </template>

                    </a-table>
                </a-tab-pane> -->
                </a-tabs>
            </a-modal>
            <a-modal v-model:visible="visibleYg" @ok="handleOkYg" @cancel="handleCancelYg" :width="500" draggable
                :height="400">
                <template #title>
                    选择员工
                </template>
                <a-form :model="pageData" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }">
                    <a-form-item label-col-flex="100px" label="公司" field="firmGroupName">
                        <a-cascader disabled v-model="pageData.firmGroupName" :options="pageData.firmGroupList"
                            allow-clear ref="casOb" @change="cascaderChange($event, pageData.firmGroupId,0)"
                            class="bacClass" :title="pageData.title" :loading="pageData.loading"
                            popup-container="html" />
                    </a-form-item>
                    <a-form-item label-col-flex="100px" label="部门" field="departmentName">
                        <a-cascader v-model="pageData.departmentName" :options="pageData.bmList" allow-clear
                            ref="casOb1" disabled @change="cascaderChange1(pageData.bmList,0)" class="bacClass"
                            :title="pageData.title1" :loading="pageData.loading1" popup-container="html" />
                    </a-form-item>
                    <a-form-item label-col-flex="100px" label="关联员工" field="ygPopId">
                        <a-select popup-container="html" allow-clear v-model="pageData.ygPopId"
                            class="bacClass ygSelect" @focus="focuss('')" @search="focuss($event)" allow-search
                            @change="changess" :popupVisible="true" :loading="pageData.loading2">
                            <a-option v-for="(item, index) in pageData.empPopList" :value="item.id">{{
                                item.code + '/' + item.name
                                }}
                            </a-option>
                        </a-select>
                    </a-form-item>
                </a-form>
            </a-modal>
            <!-- 驳布弹窗 -->
            <a-modal v-model:visible="concatClothVisible" @ok="handleOk" @cancel="handleCancel" draggable :height="400"
                :width="800">
                <template #footer>
                    <!-- <a-button @click="ReInspesction" size="large" status="warning">复检</a-button> -->
                    <a-button @click="concatClothVisible = false" style="margin: 0 20px;" size="large">取消</a-button>
                    <a-button type="primary" @click="concatClothSure" size="large" status="success">确定</a-button>
                </template>
                <div style="width:100%;" class="tableBox">
                    <div style="display: flex;margin-bottom: 5px;"> <a-button type="primary" @click="addYg" size="large"
                            status="success">添加</a-button><a-button @click="concatClothdelLine" style="margin: 0 20px;"
                            size="large">删除</a-button>
                    </div>
                    <a-table stripe :bordered="true" :columns="tableColumnsBB" :row-selection="{ type:'radio'}"
                        v-model:selected-keys="selectedRowKeyconcatCloth" :loading="table.tableLoading"
                        :data="concatClothTableData" row-key="ybRowIndex" size="mini" :pagination="false">
                        <template #zjzssss="{ record }">
                            <a-input-number v-model="record.checkRevolution" class="input-demo bacClass"
                                style="background-color: rgb(232, 243, 255);width: 100%;" :min="0" :setup="1"
                                :max="100000000000000" :precision="0" @change="concatClothNumChange(record)" />
                        </template>
                        <template #bczzzz="{ record }">
                            <a-select popup-container="html" v-model="record.shift"
                                style="background-color: rgb(232, 243, 255);">
                                <a-option value="0">白班</a-option>
                                <a-option value="1">晚班</a-option>
                            </a-select>
                        </template>
                        <template #dddd="{ record }">
                            <a-input-number v-model="record.fabricWeight" class="input-demo" setup="4"
                                style="background-color: rgb(232, 243, 255);width: 100%;" :min="0" :setup="0.01"
                                :max="record.checkWeight" :precision="pageData.decimalNum"
                                @change="concatClothNumChange(record)" />
                        </template>
                        <template #checkweight="{ record }">
                            <a-input-number v-model="record.checkWeight" class="input-demo" setup="4"
                                style="background-color: rgb(232, 243, 255);width: 100%;" :min="0" :setup="0.01"
                                :max="100000000000000" :precision="pageData.decimalNum"
                                @change="concatClothNumChange(record)" />
                        </template>
                    </a-table>
                </div>
            </a-modal>
            <a-modal v-model:visible="showModal" @ok="handleOk" @cancel="handleCancel" draggable>
                <template #footer>
                    <!-- <a-button @click="ReInspesction" size="large" status="warning">复检</a-button> -->
                    <a-button @click="onCancel" style="margin: 0 20px;" size="large">否</a-button>
                    <a-button type="primary" @click="onConfirm" size="large" status="success">是</a-button>
                </template>
                <a-space style="margin: auto;">
                    已检验，是否复检？
                </a-space>

            </a-modal>
            <a-modal v-model:visible="showModal1" @ok="handleOk" @cancel="handleCancel" draggable>
                <template #footer>
                    <!-- <a-button @click="ReInspesction" size="large" status="warning">复检</a-button> -->
                    <a-button @click="onCancel1" style="margin: 0 20px;" size="large">否</a-button>
                    <a-button type="primary" @click="onConfirm1" size="large" status="success">是</a-button>
                </template>
                <a-space style="margin: auto;">
                    是否检验其他坯布？
                </a-space>

            </a-modal>
            <!-- 保存按钮时出现的弹窗操作 -->
            <a-modal v-model:visible="showModalOP" draggable>
                <template #footer>
                    <a-button @click="onCancel2" style="margin: 0 20px;" size="large">确认通知</a-button>
                </template>
                <a-space style="margin: auto;">
                    {{ pageData.sideTitleOP }}
                </a-space>
            </a-modal>
            <a-modal v-model:visible="showModalOP1" draggable>
                <template #title>
                    系统提示
                </template>
                <span style="font-size: 18px;text-align: center;">
                    {{ pageData.sideTitleOP1 }}
                </span>
                <template #footer>
                    <a-button @click="onCancel3" style="margin: 0 10px; background-color: #165DFF;color: #fff;"
                        size="large">确定
                    </a-button>
                    <a-button @click="onCancel4" style="margin: 0 10px;background-color: #ccc;" size="large">取消
                    </a-button>
                </template>
            </a-modal>
            <a-modal v-model:visible="showModalOP2" draggable>
                <template #title>
                    系统提示
                </template>
                <span style="font-size: 18px;text-align: center;">
                    已有审核的乐捐单,乐捐如有差异请手工补单,是否继续保存?
                </span>
                <template #footer>
                    <a-button @click="onCancel5" style="margin: 0 10px; background-color: #165DFF;color: #fff;"
                        size="large">确定
                    </a-button>
                    <a-button @click="onCancel6" style="margin: 0 10px;background-color: #ccc;" size="large">取消
                    </a-button>
                </template>
            </a-modal>

        </div>
    </div>

    <script>
        // import {Form, Message, Modal} from '@arco-design/web-vue';
        // import {Message} from "@arco-design/web-vue";

        const {
            createApp,
            reactive,
            onMounted,
            ref,
            shallowReactive,
            watch,
            nextTick,
            computed
        } = Vue

        // const post = (op) => {
        //     return axios.post('http://localhost:8222/api/' + op.url, {
        //         data: op.data,
        //         headers:{
        //             token:pageData.isOpen
        //         }
        //     })
        // }


        let baseURL
        let host = window.location.host
        let reg = /^localhost+/
        if (reg.test(host)) {
            baseURL = 'http://localhost:8222/api'
        } else {
            baseURL = '/api'
        }
        const service = axios.create({
            baseURL,
            timeout: 10 * 60 * 1000,
            withCredentials: true, // 跨域请求时发送cookie
        })
        service.interceptors.response.use((res) => {
            return res.data
        })
        const Message = window.ArcoVue.Message
        const Modal = window.ArcoVue.Modal
        // console.log(Modal, window, '1')


        const useTable = function () {
            const dataList = shallowReactive([])
            const tableHeaderRef = ref(null)
            const tableFooterRef = ref(null)
            const tableHeight = ref(200)
            const bordered = ref(false)
            const striped = ref(false)
            const tableLoading = ref(true)
            const handleSuccess = (data = []) => {
                tableLoading.value = false
                dataList.length = 0
                dataList.push(...data)
                return Promise.resolve(data)
            }
            return {
                dataList,
                tableHeaderRef,
                tableFooterRef,
                tableHeight,
                bordered,
                striped,
                tableLoading,
                handleSuccess,
                useTableColumn,
                indexColumn: useTableIndexColumn(),
            }
        }

        const useRowKey = function (propName) {
            return propName
        }

        const useRowSelection = function () {
            const type = ref('checkbox')
            const showCheckedAll = true
            const selectedRowKeys = ref([])
            // const selectedRowKeysYg=ref([])
            const onSelectionChange = (tempSelectRows) => {
                selectedRowKeys.value = tempSelectRows
            }
            return {
                type,
                showCheckedAll,
                selectedRowKeys,
                // selectedRowKeysYg,
                onSelectionChange,
            }
        }

        const useTableColumn = function (
            columns,
            options = {
                dataIndex: '',
                key: '',
                align: 'center'
            }
        ) {
            return columns.map((it) => {
                return {
                    ...options,
                    ...it,
                }
            })
        }

        const useTableIndexColumn = function () {
            return {
                title: '序号',
                key: 'index',
                width: 80,
                dataIndex: 'index',
            }
        }

        const usePagination = function (callback) {

            const paginationInfo = reactive({
                page: 1,
                pageSize: 10,
                showSizePicker: true,
                total: 1,
                change: (e) => {
                    paginationInfo.page = e
                    callback()
                },
                pageSizes: ['10', '20', '30', '40'],
                setTotalSize (totalSize) {
                    paginationInfo.total = totalSize
                },
            })
            return paginationInfo
        }


        const app = createApp({
            setup: function () {
                document.onselectstart = function () {
                    return false
                }
                const getFocus = ref(null)
                const getFocusCode = ref(null)

                const pageData = reactive({
                    sideTitleOP: '',
                    sideTitleOP1: '',
                    DefectName: [],
                    showAdd: false,
                    buttonShow: false,
                    sideTitle: "查看验布历史记录",
                    dropDownData: "",
                    pageLoading: false,
                    height: 0,
                    tablediv: null,
                    // rHeight: 0,
                    DefectNameList: [],
                    isDisable: false,
                    keysNum: 1,
                    rHeight1: 0,
                    defectNameList: [],
                    defectOb: [],
                    clickDefectOb: [],
                    ckTableInfo: {},
                    ygList: [],
                    perchingGradeList: [],
                    getCkList: [],
                    warehouseName: "",
                    btnText: "关闭",
                    clothInspectorOne: "",
                    planOrderCode: "",
                    weaveCode: "",
                    billNumber: "",
                    zt: "",
                    billingDate: [],
                    clothWarehouse: 1,
                    retestDate: "",
                    monitorRetest: "",
                    dropDownData1: "",
                    isEdit: false,
                    isSave: false,
                    isJd: false,
                    isXb: false,
                    isScan: false,
                    isLook: false,
                    isCx: false,
                    isDc: false,
                    isOpen: "",
                    userList: [],
                    ygCodeList: [],
                    remarkList: [],
                    firmId: "",
                    peopleList: [],
                    monitorRetestList: [],
                    produceCode: "",
                    empName: "",
                    zjData: [],
                    cjData: [],
                    fjData: [],
                    textVal: '全屏',
                    empPopList: [],
                    ygPopId: null,
                    firmPopId: null,
                    temp: 0,
                    firmGroupId: null,
                    firmGroupList: [],
                    title: null,
                    loading: null,
                    departmentId: null,
                    bmList: [],
                    title1: null,
                    loading1: null,
                    ClothInspectionauthority: {},
                    clothCode: null,
                    recordType: null,
                    clothfiyCodeOP: '',
                    loading2: false,
                    firmGroupName: '',
                    departmentName: '',
                    decimalNum: 2
                })


                watch(() => getFocus.value, (newVal, oldVal) => {
                    if (newVal !== null)
                        getFocus.value.focus()

                })
                const post = (op) => {
                    return service.post(op.url,
                        op.data, {

                        headers: {
                            token: sessionStorage.getItem("token")
                        }
                    }
                    )
                }
                const get = (op) => {
                    return axios.get('/api/' + op.url, {
                        data: op.data,
                        headers: {
                            token: pageData.isOpen,
                            // user: getUrlSearch("username")
                        }
                    })
                }

                setInterval(() => {
                    get({
                        url: 'admin/acl/user/checkToken'
                    }).then(({ data }) => {
                        if (data.code != 200) {
                            let consFi = confirm("系统登入已过期，是否刷新页面?")
                            if (consFi) {
                                location.reload()
                            }
                        }
                    })
                }, 10000)
                //查询 表单和左下角表
                const scrollbar = ref(true)
                let AllData = {}
                let dataId = null
                let inspectNum = ref(0)

                function doRefresh (obj) {
                    if (dataForm.form.clothCode.length <= 0) {
                        Message.warning({
                            content: "布飞不存在，请重新扫描！",
                            duration: 5000,
                        })
                        initializeData()
                        return
                    }
                    AllData = {}
                    pageData.pageLoading = true
                    obj['type'] = dataForm.type
                    post({
                        url: "qms/scannedGreyCloth/scanBuFeiByQms",
                        data: obj
                    })
                        .then(({
                            data,
                            code,
                            message
                        }) => {
                            if (code === 200) {

                                AllData = data
                                inspectNum.value = data.inspectNum
                                if (dataForm.form.clothfiyCode != undefined && dataForm.form.clothfiyCode != null && dataForm.form.clothfiyCode != '' && dataForm.form.clothfiyCode != data.scannedGreyCloth.clothfiyCode) {
                                    showModal1.value = true
                                } else
                                    //判断布飞是否验布过
                                    if (data.open == 1) {
                                        showModal.value = true
                                        dataId = AllData.scannedGreyCloth['id']
                                    } else {
                                        setAllDataToView(AllData)
                                    }
                                postNumList()
                            } else {
                                Message.error({
                                    content: message,
                                    duration: 5000,
                                })
                                dataForm.form.clothCode = "1"
                                dataForm.form.clothCode = ""
                                getFocus.value.focus()
                                initializeData()
                            }
                        })
                        .catch(console.log).finally(() => {
                            pageData.pageLoading = false
                            getFocus.value.blur()
                        })
                }

                function setAllDataToView (data) {
                    dataForm.yg = data.perchingRecord.map(item => {
                        if (item.refuteClothState === undefined || item.refuteClothState === null) {
                            item.refuteClothState = 0
                        }
                        const mapObj = {
                            ...item,
                            ybRowIndex: ybRowIndex.value
                        }
                        console.log(mapObj)
                        ybRowIndex.value++
                        return mapObj
                    })
                    dataForm.ygNameList = data.perchingRecord
                    dataForm.form = data.scannedGreyCloth //里面有个clothCode是扫飞布条码出来的 扫布飞要保存起来
                    dataForm.form.openNot = dataForm.form.openNot == 0 ? '不开幅' : '开幅'
                    postNumList()
                    dataForm.form.produceCode = data.scannedGreyCloth.weavingSerialNumber
                    dataForm.ckList = data.abnormal
                    //计算总转数
                    calculateTotalrevolutions()
                    if (dataForm.form['posteriorWeight'] == undefined || dataForm.form['posteriorWeight'] == null || dataForm.form['posteriorWeight'] == "") {
                        dataForm.form['posteriorWeight'] = 0
                    }
                    if (dataForm.form['actualWeight'] == undefined || dataForm.form['actualWeight'] == null || dataForm.form['actualWeight'] == "") {
                        dataForm.form['actualWeight'] = 0
                    }
                    if (dataForm.form['timeClothShareWeight'] == undefined || dataForm.form['timeClothShareWeight'] == null || dataForm.form['timeClothShareWeight'] == "") {
                        dataForm.form['timeClothShareWeight'] = 0
                    }

                    // pageData.ygCodeList = data.empList
                    calculateRevolutions()
                }

                const total = ref(0)
                const page = ref(1)
                const size = ref(10)


                function PageSize (val) {
                    if (pageData['ClothInspectionauthority']['cx']) {
                        page.value = val
                        cxLine()
                    } else {
                        Message.warning({
                            content: '您没有权限！',
                            duration: 5000,
                        })
                    }
                }

                function change1 (val) {
                    if (pageData['ClothInspectionauthority']['cx']) {
                        size.value = val
                        cxLine()
                    } else {
                        Message.warning({
                            content: '您没有权限！',
                            duration: 5000,
                        })
                    }
                }

                function cxLine1 () {
                    page.value = 1
                    cxLine()
                }

                //查询列表数据
                const cxLine = () => {
                    var startDate = ''
                    var endDate = ''
                    if (pageData.billingDate != null && pageData.billingDate.length > 0) {
                        startDate = pageData.billingDate[0] + ' 00:00:00'
                        endDate = pageData.billingDate[1] + ' 23:59:59'
                    }
                    console.log(pageData.clothCode, '1')
                    const params = {
                        page: page.value,
                        size: size.value,
                        "empName": pageData.empName,
                        "planOrderCode": pageData.planOrderCode,
                        "produceCode": pageData.produceCode,
                        "billNumber": pageData.billNumber,
                        "billDateKs": startDate,
                        "billDateJs": endDate,
                        "clothfiyCode": paramOb.clothfiyCode,
                        "barCode": paramOb.barCode,
                        "recordType": pageData.recordType
                    }
                    if (pageData.recordType === '') {
                        params.recordType = null
                    }
                    post({
                        url: "qms/scannedGreyCloth/select",
                        data: params
                    }).then(({
                        data,
                        code,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.clothCode = null
                            paramOb.barCode = ''
                            total.value = data.total
                            dataForm.dataList = data.list
                            dataForm.dataList.forEach(function (o) {
                                if (o['openNot'] == 0) {
                                    o['openNot'] = '否'
                                } else if (o['openNot'] == 1) {
                                    o['openNot'] = '是'
                                }
                            })
                        } else {

                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }
                    })
                }

                //复检疵点记录 详情 查询
                function fjCxAll (scannedGreyClothId) {
                    post({
                        url: "qms/abnormalTwo/selectByScannedGreyClothId",
                        data: {
                            "scannedGreyClothId": scannedGreyClothId
                        }
                    }).then(({
                        data,
                        code,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.fjData = data
                        } else {

                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }
                    })
                }

                //初检疵点记录 详情 查询
                function cjCxAll (scannedGreyClothId) {
                    post({
                        url: "qms/abnormal/selectByScannedGreyClothId",
                        data: {
                            "scannedGreyClothId": scannedGreyClothId
                        }
                    }).then(({
                        data,
                        code,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.cjData = data
                        } else {

                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }
                    })
                }

                //验布值机工记录 详情 查询
                function ybCxAll (scannedGreyClothId) {
                    post({
                        url: "qms/perchingRecord/selectByScannedGreyClothId",
                        data: {
                            "scannedGreyClothId": scannedGreyClothId
                        }
                    }).then(({
                        data,
                        code,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.zjData = data
                        } else {

                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }
                    })
                }

                //两个主表
                // const selectedRowKeysYg = useRowSelection();
                const selectedRowKeysYg = ref()
                // const selectedRowKeysCk = useRowSelection();
                const selectedRowKeysCk = ref([])
                //弹窗表格
                const {
                    selectedRowKeys,
                    onSelectionChange
                } = useRowSelection()
                const selectedRowKeysJhd = useRowSelection()
                const selectedRowKeysCd = useRowSelection()
                const pagination = usePagination(doRefresh)
                const table = useTable()
                const rowKey = useRowKey("id")
                //员工表
                const tableColumnsYg = useTableColumn([{
                    title: "工号",
                    key: "checkStaffCode",
                    dataIndex: "checkStaffCode",
                    width: 60,
                    slotName: 'zjzzzz'
                }, {
                    title: "值机员工",
                    key: "checkStaff",
                    dataIndex: "checkStaff",
                    width: 70
                }, {
                    title: "班次",
                    key: "shift",
                    dataIndex: "shift",
                    width: 50,
                    slotName: "bczzzz"
                }, {
                    title: "值机重量",
                    key: "checkWeight",
                    dataIndex: "checkWeight",
                    width: 60,
                }, {
                    title: "值机转数",
                    key: "checkRevolution",
                    dataIndex: "checkRevolution",
                    width: 60,
                    slotName: "zjzssss"
                }, {
                    title: "次布重量",
                    key: "fabricWeight",
                    dataIndex: "fabricWeight",
                    width: 60,
                    slotName: 'dddd'
                },
                {
                    title: "次布转数",
                    key: "defectiveRevolutions",
                    dataIndex: "defectiveRevolutions",
                    width: 60
                },
                {
                    title: "驳布",
                    key: "refuteClothState",
                    dataIndex: "refuteClothState",
                    width: 60,
                    slotName: "refuteclothstate"
                }

                ])
                //驳布表
                const tableColumnsBB = useTableColumn([{
                    title: "工号",
                    key: "checkStaffCode",
                    dataIndex: "checkStaffCode",
                    width: 60,
                    slotName: 'zjzzzz'
                }, {
                    title: "值机员工",
                    key: "checkStaff",
                    dataIndex: "checkStaff",
                    width: 70
                }, {
                    title: "班次",
                    key: "shift",
                    dataIndex: "shift",
                    width: 50,
                    slotName: "bczzzz"
                }, {
                    title: "值机重量",
                    key: "checkWeight",
                    dataIndex: "checkWeight",
                    width: 60,
                    slotName: "checkweight",
                }, {
                    title: "值机转数",
                    key: "checkRevolution",
                    dataIndex: "checkRevolution",
                    width: 60,
                    slotName: "zjzssss"
                }, {
                    title: "次布重量",
                    key: "fabricWeight",
                    dataIndex: "fabricWeight",
                    width: 60,
                    slotName: 'dddd'
                },
                {
                    title: "次布转数",
                    key: "defectiveRevolutions",
                    dataIndex: "defectiveRevolutions",
                    width: 60
                }

                ])
                //仓库表
                const tableColumnsCk = useTableColumn([
                    {
                        title: "操作",
                        key: "deleteRow",
                        dataIndex: "deleteRow",
                        width: 40,
                        slotName: 'wwwwww'
                    }, {
                        title: "工号",
                        key: "checkStaffCode",
                        dataIndex: "checkStaffCode",
                        width: 60
                    }, {
                        title: "值机员工",
                        key: "checkStaff",
                        dataIndex: "checkStaff",
                        width: 60
                    }, {
                        title: "疵点名称",
                        key: "defectName",
                        dataIndex: "defectName",
                        width: 60
                    }, {
                        title: "疵点个数",
                        key: "defectNumber",
                        dataIndex: "defectNumber",
                        width: 60,
                        slotName: 'dddd'
                    }, {
                        title: "扣米数",
                        key: "buttonMeterNum",
                        dataIndex: "buttonMeterNum",
                        width: 60,
                        slotName: 'cccc'
                    }, {
                        title: "扣分数",
                        key: "buttonMinuteNum",
                        dataIndex: "buttonMinuteNum",
                        width: 60,
                        slotName: 'bbbb'
                    }, {
                        title: "疵点位置",
                        key: "defectPlace",
                        dataIndex: "defectPlace",
                        width: 90,
                        slotName: 'aaaa'
                    },

                ])
                //验布检验列表
                const tableColumns = useTableColumn([{
                    title: "检验单号",
                    key: "billNumber",
                    dataIndex: "billNumber",
                    width: 230
                },
                {
                    title: "织布单号",
                    key: "planOrderCode",
                    dataIndex: "planOrderCode",
                    width: 150,
                },
                {
                    title: "生产单号",
                    key: "produceCode",
                    dataIndex: "produceCode",
                    width: 150
                },
                {
                    title: "客户名称",
                    key: "client",
                    dataIndex: "client",
                    width: 100
                },
                {
                    title: "坯布编码",
                    key: "greigeCode",
                    dataIndex: "greigeCode",
                    width: 150
                }, {
                    title: "坯布名称",
                    key: "greigeName",
                    dataIndex: "greigeName",
                    width: 350
                },
                {
                    title: "机台名称",
                    key: "machine",
                    dataIndex: "machine",
                    width: 100
                },
                {
                    title: "布飞条码",
                    key: "clothCode",
                    dataIndex: "clothCode",
                    width: 100
                },
                {
                    title: "匹号",
                    key: "horses",
                    dataIndex: "horses",
                    width: 100
                },
                {
                    title: "布号",
                    key: "machineGreyCode",
                    dataIndex: "machineGreyCode",
                    width: 100
                },
                {
                    title: "磅布重量",
                    key: "checkWeight",
                    dataIndex: "checkWeight",
                    width: 100
                },
                {
                    title: "验后重量",
                    key: "posteriorWeight",
                    dataIndex: "posteriorWeight",
                    width: 100
                }, {
                    title: "次布重量",
                    key: "fabricWeightTotal",
                    dataIndex: "fabricWeightTotal",
                    width: 100
                },
                {
                    title: "验布等级",
                    key: "perchingGrade",
                    dataIndex: "perchingGrade",
                    width: 100,

                },
                {
                    title: "是否开幅",
                    key: "openNot",
                    dataIndex: "openNot",
                    width: 100
                },
                {
                    title: "是否修补",
                    key: "checkoutState",
                    dataIndex: "checkoutState",
                    width: 100,
                    slotName: 'checkoutaaaaa',
                    fixed: 'right'
                },
                {
                    title: "验布员",
                    key: "empNames",
                    dataIndex: "empNames",
                    width: 100
                },
                {
                    title: "状态",
                    key: "completeState",
                    dataIndex: "completeState",
                    width: 100,
                    slotName: 'completeaaaaa',
                    fixed: 'right'
                },
                {
                    title: "检验日期",
                    key: "billDate",
                    dataIndex: "billDate",
                    width: 200,
                },
                {
                    title: "类型",
                    key: "recordType",
                    dataIndex: "recordType",
                    slotName: 'abc',
                    width: 100,
                    fixed: 'right'
                },
                {
                    title: "详情",
                    key: "details",
                    dataIndex: "details",
                    slotName: 'detailsssss',
                    width: 100,
                    fixed: 'right'
                }
                ])
                //值机详情列表
                const tableColumnsJhd = useTableColumn([{
                    title: "值机员工编码",
                    key: "checkStaffCode",
                    dataIndex: "checkStaffCode",
                    width: 100
                },
                {
                    title: "值机员工",
                    key: "checkStaff",
                    dataIndex: "checkStaff",
                    width: 100
                }, {
                    title: "班次",
                    key: "shift",
                    dataIndex: "shift",
                    slotName: 'shift',
                    width: 100
                }, {
                    title: "值机重量",
                    key: "checkWeight",
                    dataIndex: "checkWeight",
                    width: 100
                }, {
                    title: "值机转数",
                    key: "checkRevolution",
                    dataIndex: "checkRevolution",
                    width: 100
                }, {
                    title: "次布重量",
                    key: "fabricWeight",
                    dataIndex: "fabricWeight",
                    width: 100
                },
                {
                    title: "次布转数",
                    key: "defectiveRevolutions",
                    dataIndex: "defectiveRevolutions",
                    width: 100
                }
                ])
                //疵点问题记录
                const tableColumnsCd = useTableColumn([{
                    title: "值机员工编号",
                    key: "checkStaffCode",
                    dataIndex: "checkStaffCode",
                    width: 100
                }, {
                    title: "值机员工",
                    key: "checkStaff",
                    dataIndex: "checkStaff",
                    width: 100
                }, {
                    title: "疵点名称",
                    key: "defectName",
                    dataIndex: "defectName",
                    width: 100
                }, {
                    title: "疵点个数",
                    key: "defectNumber",
                    dataIndex: "defectNumber",
                    width: 100
                }, {
                    title: "扣米数",
                    key: "buttonMeterNum",
                    dataIndex: "buttonMeterNum",
                    width: 100
                }, {
                    title: "扣分数",
                    key: "buttonMinuteNum",
                    dataIndex: "buttonMinuteNum",
                    width: 100
                },
                {
                    title: "疵点位置",
                    key: "defectPlace",
                    dataIndex: "defectPlace",
                    width: 100
                }

                ])
                const scroll = {
                    x: 2000,
                    y: 200
                }
                const tablediv = ref(null)
                // const oaBool = ref(true)
                const oaNumber = ref(null)
                const loginForm = reactive({
                    userName: "",
                    oaBool: true
                })
                //下拉框得到焦点
                const focusSel = () => {
                    selCxAll({
                        "verifyclothLevel": "", deleteState: 0
                    })
                }
                //下拉数据
                const options = ref(pageData.perchingGradeList)
                const loading = ref(false)
                const handleSearch = (value) => {
                    if (value) {
                        const ob = {
                            verifyclothLevel: value
                        }
                        loading.value = true
                        window.setTimeout(() => {
                            selCxAll(ob)
                            options.value = pageData.perchingGradeList
                            loading.value = false
                        }, 200)
                    } else {
                        options.value = []
                    }
                }

                //下拉框查询
                function selCxAll (val) {
                    post({
                        url: "qms/verifyClothLevel/VerifyclothLevelValue",
                        data: val
                    }).then(({
                        data,
                        code
                    }) => {
                        if (code === 200) {
                            // (data as string[]).splice(0, 0, "全部");
                            pageData.perchingGradeList = data

                        } else {
                            Message.error({
                                content: "查询失败！",
                                duration: 5000,
                            })
                        }
                    })
                }

                onMounted(() => {
                    login()
                    // cxAllDefectName()
                    getFocus.value?.focus()
                    dataForm.form['posteriorWeight'] = 0
                    dataForm.form['actualWeight'] = 0
                    dataForm.form['tempWeight'] = 0
                    dataForm.form['timeClothShareWeight'] = 0
                    //按下f3清空所有数据
                    document.onkeydown = function (ev) {
                        var event = ev || event
                        if (event.keyCode == 114) {
                            initializeData()
                        }
                        if (event.keyCode == 13) {
                            if (dataForm.form.clothCode != undefined && dataForm.form.clothCode != null && dataForm.form.clothCode != "") {
                                getFocus.value.blur()
                            }
                            // if (ygCodeOb.value != undefined && ygCodeOb.value != null && ygCodeOb.value.clothCode != "") {
                            //     getFocusCode.value.blur()
                            // }
                        }
                    }
                    immediateNotification()

                })

                //初始化数据
                function initializeData () {
                    dataForm.date = []
                    dataForm.form = {}
                    dataForm.yg = []
                    dataForm.ckList = []
                    dataForm.dataList = []
                    dataForm.jhdList = []
                    dataForm.CdList = []
                    dataForm.fjCdList = []
                    dataForm.ygNameList = []
                    dataForm.form['posteriorWeight'] = 0
                    dataForm.form['actualWeight'] = 0
                    dataForm.form['timeClothShareWeight'] = 0
                    materialProblem.value.checked = false
                    materialProblem1.value.checked = false
                    selectedRowKeysYg.value = []
                    isContinueXb.value = false
                    isContinueJd.value = false
                    // pageData.ClothInspectionauthority={}
                    AllData = {}
                }


                //查看历史记录
                const viewHistory = () => {

                    pageData.showAdd = true
                    pageData.sideTitle = "查看验布历史记录"
                    pageData.isEdit = false
                }
                const dataForm = reactive({
                    "id": null,
                    "jbzs": 0,
                    "date": [],
                    "zzs": 0,
                    "ybzl": 0,
                    "form": {},
                    "yhzl": 0,
                    "yg": [],
                    "ckList": [],
                    "dataList": [],
                    "jhdList": [],
                    "CdList": [],
                    "fjCdList": [],
                    "ygNameList": [],
                    "numberShifts": 0,
                    "totalRevolutions": 0,
                    "storageState": 0,
                    "type": 0,
                    "checkoutState": 0,
                    "scanCodesState": 0,


                })
                const formRef = ref()
                const sideOk = () => {
                    var dataOb = []
                    dataForm.CdList.forEach(function (o) {
                        var ob = {}
                        ob["perchingGrade"] = o["perchingGrade"]
                        ob["id"] = o["id"]
                        dataOb.push(ob)
                    })
                    formRef.value?.validate().then((err) => {

                        post({
                            url: "qms/scannedGreyCloth/newUpdate",
                            data: dataOb,
                        }).then((res) => {
                            if (res.code === 200) {

                                formRef.value?.resetFields()

                                pageData.showAdd = false

                                Message.success({
                                    content: "保存成功",
                                    duration: 5000,
                                })
                                doRefresh()
                            } else {
                                Message.error({
                                    content: res.message,
                                    duration: 5000,
                                })
                            }

                        })

                    })
                }

                const saveHandler = (number) => {
                    if (number == 1) {
                        if (!dataForm.form.perchingGradeRemark) {
                            Message.error('备注必选')
                        } else {
                            showModalOP1.value = true
                            pageData.sideTitleOP1 = '确认修补?'
                        }
                    } else if (number == 2) {
                        if (!dataForm.form.perchingGradeRemark) {
                            Message.error('备注必选')
                        } else {
                            showModalOP1.value = true
                            pageData.sideTitleOP1 = '确认降等?'
                        }
                    } else {
                        saveHandler1(number)
                    }
                }

                function onCancel3 () {
                    if (pageData.sideTitleOP1 == '确认修补?') {
                        saveHandler1(1)
                    } else {
                        saveHandler1(2)
                    }
                    showModalOP1.value = false
                }

                function onCancel4 () {
                    showModalOP1.value = false
                }

                function onCancel5 () {
                    loginForm.oaBool = false
                    copyPost1(showModalMap1.value)
                    showModalOP2.value = false
                }

                function onCancel6 () {
                    showModalOP2.value = false
                }

                //保存0/修补1/降等2
                const saveHandler1 = (num) => {

                    if (dataForm.form.clothfiyCode != '' && dataForm.form.clothfiyCode != undefined && dataForm.form.clothfiyCode != null) {
                        if (pageData['ClothInspectionauthority']['cbgxk']) {
                            if (cbcCheck.value.checked && (pageData.dropDownData1 == '' || pageData.dropDownData1 == undefined || pageData.dropDownData1 == null)) {
                                Message.warning({
                                    content: '勾选了入次布仓就要选择仓库！',
                                    duration: 5000,
                                })
                                return
                            }
                        }
                        if (dataForm.form.posteriorWeight == 0 || dataForm.form.posteriorWeight == null || dataForm.form.posteriorWeight == undefined) {
                            Message.warning({
                                content: '验后重量为0,请先验布!',
                                duration: 5000,
                            })
                            return
                        }
                        let numW = 0
                        dataForm.yg.forEach(function (o) {
                            if (o['fabricWeight'] != '' && o['fabricWeight'] != undefined && o['fabricWeight'] != null && o['refuteClothState'] == 0) {
                                numW += o['fabricWeight']
                            }
                        })
                        if ((dataForm.form.timeClothShareWeight - getcbWeightonlybb()) != numW) {
                            // record.fabricWeight=0
                            Message.warning({
                                content: '该布有次布重量,请重新分配值机员工次布重量(等于次布重量)',
                                duration: 5000,
                            })
                            return
                        }
                        // if (dataForm.form.posteriorWeight == 0) {
                        //     Message.warning({
                        //         content: '验后重量必须大于0.',
                        //         duration: 5000,
                        //     });
                        //     return
                        // }
                        if (dataForm.yg == undefined) {
                            Message.warning({
                                content: '此布飞未绑定值机员工信息',
                                duration: 5000,
                            })
                            return
                        }

                        if (dataForm.yg.length == 0) {
                            Message.warning({
                                content: '此布飞未绑定值机员工信息',
                                duration: 5000,
                            })
                            return
                        }

                        let ob = {
                            scannedGreyCloth: {
                                cutState: 0
                            }
                        }
                        if (dataForm.form['recordType'] != 2) {
                            dataForm.form['recordType'] = dataForm.type
                        }

                        if (num == 0) {
                            if (materialProblem.value.checked) {
                                dataForm.form.cutState = 1
                            } else if (materialProblem1.value.checked) {
                                dataForm.form.cutState = 2
                            } else {
                                dataForm.form.cutState = 0
                            }
                            if (pageData['ClothInspectionauthority']['cbgxk'] && cbcCheck.value.checked) {
                                dataForm.form['completeState'] = 4
                            } else {
                                dataForm.form['completeState'] = 3
                            }
                            ob['scannedGreyCloth'] = dataForm.form
                            ob['perchingRecord'] = dataForm.yg
                            ob['abnormal'] = dataForm.ckList
                            ob['empList'] = pageData.ygCodeList
                            ob['type'] = dataForm.type
                        } else if (num == 1) {
                            dataForm.form['checkoutState'] = 1
                            dataForm.form['completeState'] = 1
                            ob['scannedGreyCloth'] = dataForm.form
                            ob['perchingRecord'] = dataForm.yg
                            ob['abnormal'] = dataForm.ckList
                            ob['empList'] = pageData.ygCodeList
                            ob['type'] = dataForm.type
                        } else if (num == 2) {
                            dataForm.form['completeState'] = 2
                            dataForm.form['disposeState'] = 1
                            ob['scannedGreyCloth'] = dataForm.form
                            ob['perchingRecord'] = dataForm.yg
                            ob['abnormal'] = dataForm.ckList
                            ob['empList'] = pageData.ygCodeList
                            ob['type'] = dataForm.type
                        }
                        oaNumber.value = num
                        // let obBool = true
                        // if (loginForm.oaBool) {
                        //     post({
                        //         url: "/qms/scannedGreyCloth/getDonateRecord",
                        //         data: { clothfiyCode: pageData.clothfiyCodeOP },
                        //     }).then(({ code, data, message }) => {
                        //         if (code === 200) {
                        //             if (data.length == 0) {
                        //                 obBool = true
                        //             } else {
                        //                 if (data[0].auditState == 1) {
                        //                     // 弹窗提示，是否确定
                        //                     obBool = false
                        //                     showModalOP2.value = true
                        //                 } else {
                        //                     obBool = true
                        //                 }
                        //             }
                        //         } else {
                        //             Message.error({
                        //                 content: message,
                        //                 duration: 5000,
                        //             })
                        //         }

                        //     })
                        // }
                        // if (obBool) {
                        //     loginForm.oaBool = true
                        ob['firmId'] = dataForm.form['firmId']
                        dataForm.form['checkoutState'] = num
                        if (dataForm.type == 0) {
                            post({
                                url: "qms/scannedGreyCloth/getSaveState",
                                data: {
                                    bweight: dataForm.form.actualWeight,
                                    clothfiyCode: pageData.clothfiyCodeOP,
                                    barCode: dataForm.form.barCode
                                },
                            }).then(({ code, data, message }) => {
                                if (code === 200) {
                                    if (data == 0) {
                                        copyPost(ob)
                                    } else {
                                        //出现弹窗
                                        showModalMap.value = ''
                                        pageData.sideTitleOP = data
                                        showModalOP.value = true
                                        showModalMap.value = ob
                                        inspectNum.value = 0
                                    }
                                } else {
                                    Message.error({
                                        content: message,
                                        duration: 5000,
                                    })
                                }

                            })
                        } else {
                            copyPost(ob)
                        }
                        // }
                    } else {
                        Message.warning({
                            content: '请先扫码',
                            duration: 5000,
                        })
                    }
                }

                const copyPost = (ob) => {
                    // let obBool = false
                    if (loginForm.oaBool) {
                        post({
                            url: "/qms/scannedGreyCloth/getDonateRecord",
                            data: { clothfiyCode: pageData.clothfiyCodeOP },
                        }).then(({ code, data, message }) => {
                            if (code === 200) {
                                if (data.length == 0) {
                                    // obBool = true
                                    copyPost1(ob)
                                } else {
                                    if (data[0].auditState == 1) {
                                        // 弹窗提示，是否确定
                                        obBool = false
                                        showModalMap1.value = ''
                                        showModalMap1.value = ob
                                        showModalOP2.value = true
                                        console.log('出现弹窗')
                                    } else {
                                        // obBool = true
                                        copyPost1(ob)
                                    }
                                }
                            } else {
                                Message.error({
                                    content: message,
                                    duration: 5000,
                                })
                            }

                        })
                    }
                    // if (obBool) {
                    //     console.log('进入保存')

                    // }

                }
                const copyPost1 = (ob) => {
                    loginForm.oaBool = true
                    post({
                        url: "qms/scannedGreyCloth/insert",
                        data: ob,
                    }).then(({
                        code,
                        data,
                        message
                    }) => {
                        if (code === 200) {
                            Message.success({
                                content: "保存成功",
                                duration: 5000,
                            })
                            initializeData()
                            if (dataForm.type === 2) {
                                dataForm.type = 0
                            }
                            dataForm.type = 0
                            inspectNum.value = 0
                            // pageData.buttonShow = false
                            dataForm.form.clothCode = ""
                            pageData.dropDownData1 = ''
                            cbcCheck.value.checked = false
                            getFocus.value.focus()
                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                            initializeData()
                        }

                    })
                }
                //判断是否填写了中文
                const isChiese = (value, cb) => {
                    return new Promise(resolve => {
                        if (window.encodeURI(value).indexOf('%') !== -1) {
                            cb('填写的值只能是英文数字组合或英文，数字！')
                        }
                        resolve()
                    })

                }
                //导出
                const dcLine = () => {
                    if (selectedRowKeysCk.value.length === 0) {
                        Message.error('请先勾选')
                        return
                    } else {
                        let head = ""
                        let body = ""

                        //将表头拼接出来
                        head +=
                            "<th>检验单号</th><th>织布单号</th><th>生产单号</th><th>客户名称</th><th>坯布编码</th><th>坯布名称</th><th>机台名称</th><th>布飞条码</th>" +
                            "<th>匹号</th><th>布号</th><th>磅布重量</th><th>验后重量</th><th>次布重量</th><th>验布等级</th><th>是否开幅</th><th>是否修补</th><th>验布员</th><th>状态</th><th>检验日期</th><th>类型</th>"
                        //验布检验列表
                        let nowRow = dataForm.dataList.filter(function (o) {
                            return selectedRowKeysCk.value.indexOf(o["id"]) !== -1
                        })

                        nowRow.forEach(function (o) {
                            body += "<tr>"
                            body += `<td style="mso-number-format:'\\@'">` + o["billNumber"] + "</td>"
                            body += "<td>" + o["planOrderCode"] + "</td>"
                            body += "<td>" + o["produceCode"] + "</td>"
                            body += "<td>" + o["client"] + "</td>"
                            body += "<td>" + o["greigeCode"] + "</td>"
                            body += "<td>" + o["greigeName"] + "</td>"
                            body += "<td>" + o["machine"] + "</td>"
                            body += "<td>" + o["clothCode"] + "</td>"
                            body += "<td>" + o["horses"] + "</td>"
                            body += "<td>" + o["machineGreyCode"] + "</td>"
                            body += "<td>" + o["checkWeight"] + "</td>"
                            body += "<td>" + o["posteriorWeight"] + "</td>"
                            body += "<td>" + o["fabricWeightTotal"] + "</td>"
                            body += "<td>" + o["perchingGrade"] + "</td>"
                            body += "<td>" + (o["openNot"] == 0 ? '否' : '是') + "</td>"
                            body += "<td>" + (o["checkoutState"] == 0 ? '无需修补' : '修补过') + "</td>"
                            body += "<td>" + o["empNames"] + "</td>"
                            body += "<td>" + (o["completeState"] == 0 ? '未完成' : o["completeState"] == 1 ? '修补中' : o["completeState"] == 2 ? '降等中' : o["completeState"] == 3 ? '已通过' : '不合格') + "</td>"
                            body += "<td>" + o["billDate"] + "</td>"
                            body += "<td>" + (o["recordType"] == 0 ? '初检' : o["recordType"] == 1 ? '抽检' : '复检') + "</td>"
                            body += "</tr>"
                        })


                        tableToXlsx(head, '验布历史记录', body)
                    }
                }

                function tableToXlsx (head, filename, body) {
                    const uri = 'data:application/vnd.ms-excel;base64,',
                        template = `<html>
            <head><meta charset="UTF-8"></head>
            <body><table border="1"><tr>${head}</tr>${body}</table></body>
        </html>`

                    const a = document.createElement('a')
                    a.href = uri + window.btoa(unescape(encodeURIComponent(template)))
                    a.download = filename
                    a.click()
                    document.removeChild(a)
                }


                //弹出框的方法
                const visible = ref(false)

                var defectName = ref("")
                const handleBeforeOk = (done) => {
                    done()

                }
                const handleCancel = () => {
                    getFocus.value.focus()
                    visible.value = false
                }
                //定时 区分单双击
                let clickTimeId
                //点击员工 加行数
                const clickName = (cdName, num) => {
                    clearTimeout(clickTimeId)
                    // dataForm.yg 员工
                    console.log(selectedRowKeysYg.value)
                    console.log(dataForm.yg)
                    if (dataForm.yg.length == 1) {
                        var tempList = []
                        tempList.push(dataForm.yg[0]['checkStaffCode'])
                        selectedRowKeysYg.value = tempList
                    }
                    if (selectedRowKeysYg.value == undefined) {
                        Message.error({
                            content: '请先勾选一条员工表再点击疵点添加疵点或删除疵点',
                            duration: 5000
                        })
                        return
                    }
                    if (selectedRowKeysYg.value.length != 1) {
                        Message.error({
                            content: '请先勾选一条员工表再点击疵点添加疵点或删除疵点',
                            duration: 5000
                        })
                        return
                    }
                    let ygDataRow = dataForm.yg.filter(function (o) {
                        return o['checkStaffCode'] == selectedRowKeysYg.value[0]
                    })
                    defectName.value = cdName
                    let name = ygDataRow[0]['checkStaff']
                    let code = ygDataRow[0]['checkStaffCode']
                    const list = []
                    let isExist = false
                    var ob = null

                    for (var i = 0; i < dataForm.ckList.length; i++) {
                        if (dataForm.ckList[i]["checkStaff"] == name && dataForm.ckList[i]["defectName"] == defectName.value) {
                            ob = dataForm.ckList[i]
                            break
                        }
                    }

                    clickTimeId = setTimeout(function () {
                        if (ob != null && num == 1) {
                            //行里有相同的员工和疵点名称 此行的疵点个数就加一
                            ob["defectNumber"]++
                        } else if (ob == null && num == 1) {
                            //行里有相同的员工和疵点名称 此行的疵点个数就加一
                            ob = {
                                "checkStaff": name,
                                "checkStaffCode": code,
                                "defectName": defectName.value,
                                "defectNumber": 1,
                                "buttonMeterNum": 0,
                                "buttonMinuteNum": 0,
                                "defectPlace": ""
                            }
                            list.push(ob)
                        } else if (ob != null && num == 2) {
                            if (ob["defectNumber"] == 0) {
                                Message.error({
                                    content: '疵点个数为0了！不能再减了',
                                    duration: 5000,
                                })
                                dataForm.ckList = dataForm.ckList.filter(function (o) {
                                    return !(o["checkStaff"] == name && o["defectName"] == defectName.value)
                                })
                            } else {
                                ob["defectNumber"]--
                            }
                        } else {
                            Message.error({
                                content: '找不到对应员工的疵点信息！不能再减了',
                                duration: 5000,
                            })
                        }
                        if (list.length > 0) {
                            for (let i = 0; i < list.length; i++) {
                                dataForm.ckList.unshift(list[i])
                            }
                        }
                    }, 250)

                }

                let isShow = ref(true)

                //布飞条码的值
                const changeTm = (val) => {
                    if (pageData.ygCodeList.length == 0) {
                        Message.warning({
                            content: '请先扫员工码再扫布飞',
                            duration: 5000,
                        })
                        dataForm.form.clothCode = 1
                        dataForm.form.clothCode = ""
                        return
                    }

                    //根据流水将二维码的值取出来
                    var paramMap = {
                        "clothfiyCode": "",
                        "barCode": ""
                    }

                    if (dataForm.form.clothCode.indexOf('{') != -1) {
                        dataForm.form.clothCode = JSON.parse(dataForm.form.clothCode)
                        paramMap.clothfiyCode = dataForm.form.clothCode.clothfiyCode
                        pageData.clothfiyCodeOP = dataForm.form.clothCode.clothfiyCode
                    } else {
                        paramMap.barCode = dataForm.form.clothCode
                    }
                    doRefresh(paramMap)
                    // post({
                    //     url: "planSingle/clothfiy/getQRCode",
                    //     data: paramMap
                    // }).then(({
                    //     code,
                    //     data,
                    //     message
                    // }) => {
                    //     if (code === 200) {

                    //         dataForm.form.clothCode = data;
                    //         doRefresh()
                    //         dataForm.form.clothCode = ""
                    //     } else {
                    //         Message.error({
                    //             content: message,
                    //             duration: 5000,
                    //         });
                    //         dataForm.form.clothCode = undefined;
                    //     }

                    // });


                }
                const openPop = () => {
                    isShow.value = !isShow.value
                    if (isShow.value) {
                        pageData.btnText = "关闭"
                    } else {
                        pageData.btnText = "显示"
                    }


                }
                //关闭弹窗按钮
                // const closeHandler = () => {
                //     isShow.value = false;
                // }

                //下拉框得到焦点
                const focusSel1 = () => {
                    selCxAll1({
                        "firmId": pageData.firmId,
                        "warehouseTypeName": "次布仓",
                    })
                    getFirm()
                }
                //下拉数据
                const options1 = ref(pageData.getCkList)
                const loading1 = ref(false)
                const handleSearch1 = (value) => {
                    if (value) {
                        const ob = {
                            "firmId": pageData.firmId,
                            "warehouseTypeName": "次布仓",
                        }
                        loading1.value = true
                        window.setTimeout(() => {
                            selCxAll1(ob)
                            options1.value = pageData.getCkList
                            loading1.value = false
                        }, 200)
                    } else {
                        options1.value = []
                    }
                }

                //获取仓库下拉框
                function selCxAll1 (ob) {
                    post({
                        url: "wms/warehouse/getWarehouseByPara",
                        data: ob
                    }).then(({
                        code,
                        data,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.getCkList = data
                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }

                    })
                }

                const changeClothWarehouse = (value, ev) => {
                    if (value) {
                        pageData.clothWarehouse = 1
                    } else {
                        pageData.clothWarehouse = 0
                    }

                }
                //点击编辑 疵点列表可修改
                const editHandler = (rowData) => {
                    pageData.isEdit = true
                    dataForm.form.perchingGrade = rowData.perchingGrade
                }

                //获取用户列表
                const focusDl = () => {

                    get({
                        url: "admin/acl/user/index?page=1&limit=100000&accountType=1",
                    }).then(({
                        code,
                        data,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.userList = data.items
                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }

                    })
                }

                pageData.isOpen = sessionStorage.getItem('USER-TOKEN-KEY')

                //登录按钮
                const login = () => {
                    get({
                        url: "admin/acl/user/givenLoginUser?username=" + getUrlSearch("username"),

                    }).then((res) => {

                        if (res.data.code == 200) {

                            sessionStorage.setItem("token", res.data.data.token)
                            pageData.isOpen = res.data.data.token
                            Message.success({
                                content: '登陆成功',
                                duration: 5000,
                            })
                            //查询所有疵点名称
                            selCxAll({
                                "verifyclothLevel": ""
                            })
                            getRemark()
                            post({
                                url: "qms/defectType/select",

                                data: {
                                    "defectName": "",
                                    "deleteState": 0
                                }
                            }).then(({
                                data,
                                code,
                                message
                            }) => {

                                if (code === 200) {

                                    // (data as string[]).splice(0, 0, "全部");
                                    pageData.defectNameList = data

                                } else {
                                    Message.error({
                                        content: message,
                                        duration: 5000,
                                    })
                                }
                            })
                            getFirm()
                        } else {
                            Message.error({
                                content: res.data.message,
                                duration: 5000,
                            })
                        }

                    })
                }
                //获取url传的参数
                const getUrlSearch = (name => {
                    // 未传参，返回空
                    if (!name) {
                        return null
                    }
                    ;
                    // 查询参数：先通过search取值，如果取不到就通过hash来取
                    var after = window.location.search
                    after = after.substr(1) || window.location.hash.split('?')[1]
                    // 地址栏URL没有查询参数，返回空
                    if (!after) return null
                    // 如果查询参数中没有"name"，返回空
                    if (after.indexOf(name) === -1) return null

                    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
                    // 当地址栏参数存在中文时，需要解码，不然会乱码
                    var r = decodeURI(after).match(reg)
                    // 如果url中"name"没有值，返回空
                    if (!r) return null
                    return r[2]
                })
                //次布重量的勾选框
                let changeInp = false
                const changeCb = (val) => {
                    if (val.target.checked) {
                        changeInp = true
                    } else {
                        changeInp = false
                    }

                }
                var port, textEncoder, writableStreamClosed, writer, historyIndex = -1
                let baud = ref(null)
                watch(() => baud.value, (newVal, oldVal) => {
                    baud.value = (localStorage.baud == undefined ? 9600 : localStorage.baud)
                    const lineHistory = []

                })


                //计算验后重量
                function WeightAfterInspection () {
                    checkWeight()
                    if (dataForm.form.actualWeight != undefined &&
                        dataForm.form.actualWeight != null &&
                        dataForm.form.timeClothShareWeight != undefined &&
                        dataForm.form.timeClothShareWeight != null) {
                        dataForm.form.posteriorWeight = customRound((parseFloat(dataForm.form.actualWeight) - parseFloat(dataForm.form.timeClothShareWeight)), pageData.decimalNum)
                    } else {
                        dataForm.form.posteriorWeight = 0
                    }
                }

                //初始化 员工扫码框对象
                let ygCodeOb = ref(null)
                //存储员工对应的公司id
                let verifyCompanyIdList = []
                //员工扫码 改变
                const changeYg = (val, ob) => {
                    if (ob == undefined || ob == null || ob == "") {
                        return
                    }
                    let ob1 = {
                        empName: "",
                        empCode: "",
                        empId: ""
                    }
                    if (ob.indexOf('{') != -1) {
                        ob = JSON.parse(ob)
                        if (ob['empName'] == undefined || ob['empNo'] == undefined || ob['id'] == undefined) {
                            Message.warning({
                                content: '请扫描正确的员工码！',
                                duration: 5000,
                            })
                            ygCodeOb.value = ""
                            return
                        }
                        ob1['empName'] = decodeURI(ob['empName'])
                        ob1['empCode'] = decodeURI(ob['empNo'])
                        ob1['empId'] = decodeURI(ob['id'])
                        setYgOb(ob1)
                    } else {
                        get({
                            url: "org/hrEmployee/getEmpByBarCode/" + ob,
                        }
                        ).then((res) => {
                            if (res.data.code == 200) {
                                if (res.data.data == null || res.data.data == undefined) {
                                    Message.error({
                                        content: "员工码不存在",
                                        duration: 5000,
                                    })
                                    ygCodeOb.value = ""
                                    return
                                }
                                if (verifyCompanyIdList.length > 0 && verifyCompanyIdList[0].companyId != res.data.data.companyId) {
                                    Message.error({
                                        content: "员工码不属于此公司",
                                        duration: 5000,
                                    })
                                    ygCodeOb.value = ""
                                    return
                                }
                                verifyCompanyIdList.push({ companyId: res.data.data.companyId, id: res.data.data.id })
                                ob1['empName'] = decodeURI(res.data.data['name'])
                                ob1['empCode'] = decodeURI(res.data.data['code'])
                                ob1['empId'] = decodeURI(res.data.data['id'])
                                setYgOb(ob1)
                                //拿权限
                            } else {
                                Message.error({
                                    content: res.data.message,
                                    duration: 5000,
                                })
                            }

                        })
                    }


                }

                function setYgOb (ob1) {
                    let isCz = false
                    if (ob1['empName'] != '' && ob1['empId'] != '') {
                        if (pageData.ygCodeList.length > 0) {
                            pageData.ygCodeList.forEach(function (o) {
                                if (o["empId"] == ob1['empId']) {
                                    isCz = true
                                }
                            })
                            if (!isCz) {
                                pageData.ygCodeList.push(ob1)
                            }
                        } else {
                            pageData.ygCodeList.push(ob1)
                        }
                    }
                    getPermissionByEmpIds()
                    ygCodeOb.value = ""
                    // getFocusCode.value.blur()
                }

                function blurYg () {

                    ygCodeOb.value = undefined
                    ygCodeOb.value = ""

                }

                //删除员工名称
                const clickDel = (id) => {
                    verifyCompanyIdList = verifyCompanyIdList.filter((item) => {
                        return item.id != id
                    })
                    pageData.ygCodeList = pageData.ygCodeList.filter(function (o) {
                        return o['empId'] != id
                    })
                }
                //验布备注下拉框 remarkList
                const getRemark = () => {
                    post({
                        url: "qms/VerifyclothRemark/select",
                        data: { "remark": "", deleteState: 0 }
                    }).then(({
                        code,
                        data,
                        message
                    }) => {
                        if (code === 200) {
                            pageData.remarkList = data
                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }

                    })
                }
                //点击重量的大盒子 将勾选框勾上
                //勾选框元素
                let cbWeight = ref()
                const clickCbZl = () => {
                    //次布不等于0的情况下点击赋值
                    if (dataForm.form.tempWeight == undefined || dataForm.form.tempWeight == null || dataForm.form.tempWeight == "") {
                        // dataForm.form.timeClothShareWeight = 0
                        dataForm.form.timeClothShareWeight = getcbWeightonlybb()

                    } else {
                        if (dataForm.form.tempWeight > getcbWeightonlybb()) {
                            dataForm.form.timeClothShareWeight = dataForm.form.tempWeight

                        } else {
                            dataForm.form.timeClothShareWeight = getcbWeightonlybb()
                        }

                        // 如果员工只有一条的时候 则直接赋值次布重量和计算
                        const filterYg = dataForm.yg.filter((item) => item.refuteClothState === 0)

                        if (filterYg.length == 1) {
                            //第一个员工的值机转数=交班转数
                            dataForm.yg.forEach(item => {
                                if (item.refuteClothState === 0) {
                                    item['fabricWeight'] = parseFloat(dataForm.form.timeClothShareWeight - getcbWeightonlybb())
                                }
                            })
                            calculateRevolutions()
                        }
                    }
                    WeightAfterInspection()


                }
                let cbcCheck = ref()
                let materialProblem = ref()
                let materialProblem1 = ref()
                const clickMaterial = () => {

                }
                const ruCbc = () => {
                    if (cbcCheck.value.checked) {
                        cbcCheck.value.checked = false
                        isContinueXb.value = false
                        isContinueJd.value = false
                    } else {
                        cbcCheck.value.checked = true
                        isContinueXb.value = true
                        isContinueJd.value = true
                    }


                }

                //拿到此登录人所属的公司
                function getFirm () {
                    get({
                        url: "admin/acl/user/userObject?userName=" + getUrlSearch("username"),

                    }
                    ).then((res) => {
                        if (res.data.code == 200) {
                            pageData.firmId = res['data']['data']['map']['user']['firmGroupId']
                        } else {
                            Message.error({
                                content: res.data.message,
                                duration: 5000,
                            })
                        }

                    })
                }

                //模糊查询验布员工
                const getPeopleList = (num) => {
                    let ob = {}
                    if (num == 1) {
                        ob['clothInspectorOne'] = ""
                    } else {
                        ob['monitorRetest'] = ""
                    }
                    post({
                        url: "qms/scanEmp/getScanEmpList",
                        data: ob
                    }).then(({
                        code,
                        data,
                        message
                    }) => {
                        if (code === 200) {
                            if (num == 1) {
                                pageData.peopleList = data
                            } else {
                                pageData.monitorRetestList = data
                            }

                        } else {
                            Message.error({
                                content: message,
                                duration: 5000,
                            })
                        }

                    })
                }
                //手填 求列表转数
                const zsBlur = () => {
                    //判断 如果只有dataForm.yg只有一个 则总转数=交班转数
                    if (dataForm.yg.length == 1) {
                        dataForm.totalRevolutions = dataForm.numberShifts
                        //第一个员工的值机转数=总转数
                        dataForm.yg[0]['checkRevolution'] = dataForm.totalRevolutions
                        //第一个员工的值机重量=重量
                        dataForm.yg[0]['checkWeight'] = parseFloat(getActualWeightNobb())
                    } else {
                        if (dataForm.totalRevolutions != 0 && dataForm.numberShifts != 0) {
                            //第一个员工的值机转数=交班转数
                            dataForm.yg[0]['checkRevolution'] = dataForm.numberShifts
                            //第二个员工=总转数-交班转数
                            dataForm.yg[1]['checkRevolution'] = dataForm.totalRevolutions - dataForm.numberShifts
                            //第一个员工的值机重量=值机转数/总转数*重量
                            dataForm.yg[0]['checkWeight'] = dataForm.numberShifts / dataForm.totalRevolutions * parseFloat(getActualWeightNobb())
                            //第二个员工值机重量
                            dataForm.yg[1]['checkWeight'] = parseFloat(getActualWeightNobb()) - dataForm.yg[0]['checkWeight']
                        }
                    }


                }
                let popYgData = ref({
                    "checkStaffCode": "",
                    "checkStaff": "",
                    "shift": "",
                    "checkWeight": "",
                    "checkRevolution": "",
                    "fabricWeight": "",
                    "id": null
                })
                //添加员工列
                const addYg = () => {
                    //判断第一行是否有选员工
                    // if(dataForm.yg[0]['checkStaffCode']==undefined||dataForm.yg[0]['checkStaffCode']==""){
                    //     Message.warning({
                    //             content: '请先选择第一行的值机员工',
                    //             duration: 5000,
                    //         });
                    // }else{
                    //     dataForm.yg.push({"checkStaffCode":"","checkStaff":"","shift":"","checkWeight":"","checkRevolution":"","fabricWeight":""})
                    // }
                    if (dataForm.form.clothfiyCode != '' && dataForm.form.clothfiyCode != undefined && dataForm.form.clothfiyCode != null) {
                        pageData.firmGroupName = ''
                        pageData.departmentName = ''
                        getFirmGroup()
                        pageData.firmPopId = null
                        pageData.ygPopId = null
                        visibleYg.value = true
                        pageData.firmGroupId = ''
                        pageData.departmentId = ''
                        pageData.ygPopId = ''

                        nextTick(() => {
                            let selectEl = document.querySelector('.ygSelect')
                            let inputEl = document.querySelector('.ygSelect input')
                            selectEl.click()
                            inputEl.focus()
                            focuss('')
                        })
                    } else {
                        Message.warning({
                            content: '请先扫描布飞条码',
                            duration: 5000,
                        })
                        return
                    }
                }
                const visibleYg = ref(false)
                // let i=0;
                const handleOkYg = async () => {
                    if (pageData.ygPopId == null || pageData.ygPopId == undefined) {
                        Message.warning({
                            content: '请先选择员工！',
                            duration: 5000,
                        })
                    } else {
                        //拿到用户所选的员工
                        let filter = pageData.empPopList.filter(function (o) {
                            return o['id'] == pageData.ygPopId
                        })
                        if (filter.length > 0) {
                            console.log(1111111111111111)
                            //改变地址值
                            let str = JSON.stringify(popYgData.value)
                            let ob = JSON.parse(str)
                            ob['checkStaffCode'] = filter[0]['code']
                            ob['checkStaff'] = filter[0]['name']
                            ob['checkEmpId'] = filter[0]['id']
                            try {
                                const res = await post({
                                    url: 'planSingle/dutymachineMachine/selectShift',
                                    data: {
                                        clothUserId: pageData.ygPopId,
                                        machineCode: dataForm.form.machine
                                    },
                                })
                                if (res.code == 200) {
                                    ob['shift'] = res.data
                                } else {
                                    Message.warning({
                                        content: res.message,
                                        duration: 5000,
                                    })
                                }
                            } catch (error) {
                                console.log(error)
                            }
                            // ob['id']='add'+(i++)
                            //判断左下角表格是否已有这个员工
                            if (concatClothVisible.value) {
                                // concatClothTableData
                                let list = []
                                //     concatClothTableData.value.filter(function (o) {
                                //     return o['checkStaffCode'] == ob['checkStaffCode']
                                // }) //欧国惠说允许重复
                                if (list.length > 0) {
                                    Message.warning({
                                        content: '此员工已选择！请重新选择',
                                        duration: 5000,
                                    })
                                } else {
                                    ob.depIdByUser = pageData.departmentId
                                    ob.depNameByUser = pageData.departmentName
                                    ob.companyNameByUser = pageData.firmGroupName
                                    ob.companyIdByUser = pageData.firmGroupId
                                    ob.refuteClothState = 1
                                    ob.ybRowIndex = ybRowIndex.value
                                    ybRowIndex.value++
                                    console.log(ob)
                                    concatClothTableData.value.unshift(ob)
                                    visibleXq.value = false
                                }
                            } else {
                                let list = dataForm.yg.filter(function (o) {
                                    return o['checkStaffCode'] == ob['checkStaffCode']
                                })
                                if (list.length > 0) {
                                    Message.warning({
                                        content: '此员工已有值机记录！请重新选择',
                                        duration: 5000,
                                    })
                                } else {
                                    ob.depIdByUser = pageData.departmentId
                                    ob.depNameByUser = pageData.departmentName
                                    ob.companyNameByUser = pageData.firmGroupName
                                    ob.companyIdByUser = pageData.firmGroupId
                                    ob.refuteClothState = 0
                                    ob.ybRowIndex = ybRowIndex.value
                                    ybRowIndex.value++
                                    console.log(ob)
                                    dataForm.yg.unshift(ob)
                                    visibleXq.value = false
                                }
                            }

                        }
                    }


                }
                const handleCancelYg = () => {
                    visibleXq.value = false
                }
                // //根据员工编号一对一找出员工名称
                // const changeStaff = (record, val) => {
                //     if (val != "" && val != undefined) {
                //         post({
                //             url: 'org/hrEmployee/getEmpListByUser',
                //             data: {

                //             },
                //         }).then(res => {
                //             if (res.code == 200) {
                //                 pageData.empPopList = res.data;
                //             } else {
                //                 Message.error({
                //                     content: message,
                //                     duration: 5000,
                //                 });
                //             }

                //         });
                //     }
                // }

                //重量改变  值机转数/总转数*重量=这人的值机重量
                function changeWeight () {
                    dataForm.yg.forEach(function (o) {
                        if (o.refuteClothState === 0) {
                            if (o['checkRevolution'] == undefined || o['checkRevolution'] == null || o['checkRevolution'] == '') {
                                o['checkRevolution'] = 0
                            }
                            if (dataForm['totalRevolutions'] == undefined || dataForm['totalRevolutions'] == null || dataForm['totalRevolutions'] == '') {
                                dataForm['totalRevolutions'] = 0
                            }
                            if (dataForm.form['actualWeight'] == undefined || dataForm.form['actualWeight'] == null || dataForm.form['actualWeight'] == '') {
                                dataForm.form['actualWeight'] = 0
                            }
                            if (dataForm.totalRevolutions != 0 && o['checkRevolution'] != 0) {
                                o['checkWeight'] = customRound((parseFloat(o['checkRevolution']) / parseFloat(dataForm.totalRevolutions) * parseFloat(dataForm.form.actualWeight - getActualWeightonlybb())), 2)
                                //                        o['checkWeight'] = customRound((parseFloat(o['checkRevolution']) / parseFloat(dataForm.totalRevolutions) * parseFloat(dataForm.form.actualWeight)), 2)
                            } else {
                                o['checkWeight'] = 0
                            }
                        }
                    })

                }

                //计算每行次布重量加起来是否不等于次布的重量
                function changeHcb (record, fabricWeight) {
                    if (record.refuteClothState === 1) {
                        concatClothNumChange(record)
                        console.log(lastTimeWeight.value, getcbWeightonlybb(), "********************")

                        dataForm.form.timeClothShareWeight = dataForm.form.timeClothShareWeight - lastTimeWeight.value + getcbWeightonlybb()
                        lastTimeWeight.value = getcbWeightonlybb()
                        WeightAfterInspection()
                        return
                    }
                    if (dataForm.form.timeClothShareWeight == '' || dataForm.form.timeClothShareWeight == undefined || dataForm.form.timeClothShareWeight == null) {
                        dataForm.form.timeClothShareWeight = 0

                    }
                    nextTick(() => {
                        let totalW = parseFloat(dataForm.form.timeClothShareWeight - getcbWeightonlybb())
                        let numW = 0
                        let isWrite = false
                        dataForm.yg.forEach(function (o) {
                            if (o.refuteClothState === 0) {
                                if (o['fabricWeight'] != '' && o['fabricWeight'] != undefined && o['fabricWeight'] != null && o['fabricWeight'] != 0) {
                                    numW += o['fabricWeight']
                                } else {
                                    isWrite = true
                                }
                            }

                        })
                        if (!isWrite) {
                            if (totalW != numW) {
                                record.fabricWeight = 0
                                Message.warning({
                                    content: '次布重量列总和要等于表单里的次布重量！',
                                    duration: 5000,
                                })
                            }
                        }

                        calculateRevolutions()
                    })
                    checkygWeight()
                    WeightAfterInspection()
                }

                const visibleXq = ref(false)

                const handleClickXq = (val) => {
                    visibleXq.value = true
                    //初检
                    cjCxAll(val['id'])
                    //复检
                    // fjCxAll(val['id'])
                    //验布值机
                    ybCxAll(val['id'])
                }
                const handleOkXq = () => {
                    visibleXq.value = false
                }
                const handleCancelXq = () => {
                    visibleXq.value = false
                }

                //全屏
                function fullScreen () {
                    //全屏
                    if (pageData.textVal == '全屏') {
                        if (document.documentElement.RequestFullScreen) {
                            document.documentElement.RequestFullScreen()
                        }
                        //兼容火狐
                        if (document.documentElement.mozRequestFullScreen) {
                            document.documentElement.mozRequestFullScreen()
                        }
                        //兼容谷歌等可以webkitRequestFullScreen也可以webkitRequestFullscreen
                        if (document.documentElement.webkitRequestFullScreen) {
                            document.documentElement.webkitRequestFullScreen()
                        }
                        //兼容IE,只能写msRequestFullscreen
                        if (document.documentElement.msRequestFullscreen) {
                            document.documentElement.msRequestFullscreen()
                        }
                        pageData.textVal = '退出全屏'
                    } else if (pageData.textVal == '退出全屏') {
                        if (document.exitFullScreen) {
                            document.exitFullscreen()
                        }
                        //兼容火狐
                        if (document.mozCancelFullScreen) {
                            document.mozCancelFullScreen()
                        }
                        //兼容谷歌等
                        if (document.webkitExitFullscreen) {
                            document.webkitExitFullscreen()
                        }
                        //兼容IE
                        if (document.msExitFullscreen) {
                            document.msExitFullscreen()
                        }
                        pageData.textVal = '全屏'
                    }

                }

                // //获取公司部门组列表
                // const getFirmGroup = () => {
                //     get({
                //         url: 'org/firmGroup/getTreeFirmGroup',
                //     }).then((res) => {
                //         if (res.data.code === 200) {
                //             pageData.firmList = res.data.data
                //         }
                //     })
                // };

                //值机转数改变
                function zjzsChange (record) {
                    if (record?.refuteClothState === 1) {
                        concatClothNumChange(record)
                        return
                    }
                    console.log('非驳布值机转数改变')
                    //计算总转数
                    calculateTotalrevolutions()
                    //计算值机重量
                    changeWeight()
                    checkygWeight()
                }

                //计算总转数
                function calculateTotalrevolutions () {
                    let nums = 0
                    dataForm.yg.forEach(function (o) {
                        if (o.refuteClothState === 0) {
                            nums += parseFloat(o['checkRevolution'])
                        }
                        console.log(o['refuteClothState'])
                    })
                    dataForm.totalRevolutions = nums

                }

                var ws = null
                //左下角 删除
                const delLine = () => {
                    if (selectedRowKeysYg.value.length === 0) {
                        Message.error({
                            content: '请先勾选',
                            duration: 5000
                        })
                        return
                    }
                    dataForm.yg = dataForm.yg.filter(function (o) {
                        return !selectedRowKeysYg.value.includes(o.ybRowIndex)
                    })
                    calculateTotalrevolutions()
                    WeightAfterInspection()
                    selectedRowKeysYg.value.length = 0
                    const filterYg = dataForm.yg.filter((item) => item.refuteClothState === 0)
                    if (filterYg.length == 1) {
                        //当表格中一个员工时，所有次布重量都赋值给这个员工
                        dataForm.yg.forEach((item) => {
                            if (item.refuteClothState === 0) {
                                item.fabricWeight = parseFloat(dataForm.form.timeClothShareWeight - getcbWeightonlybb())
                                changeHcb(item, item.fabricWeight)
                            }
                        })

                    }
                    changeWeight()
                }

                function send () {
                    ws.send(pageData.temp)
                }

                var temp = 0
                var tempStr = 0

                //通信传输重量
                function immediateNotification () {
                    ws = new ReconnectingWebSocket('ws://127.0.0.1:8989')

                    //请求后台拿到数据
                    ws.onopen = function () {
                        console.log("ws连接成功！！！")

                    }
                    ws.onmessage = function (e) {
                        if (e['data'] != undefined && e['data'] != "" && e['data'] != null) {
                            console.log('重量：', dataForm.form.tempWeight, '小数位', pageData.decimalNum, '磅布重量：', dataForm.form.actualWeight)
                            //装每次的重量
                            dataForm.form.tempWeight = customRound(parseFloat(e['data']), pageData.decimalNum)

                            // if (tempStr == dataForm.form.tempWeight) {
                            //     temp++;
                            // } else {
                            //     tempStr = dataForm.form.tempWeight;
                            //     temp = 0;
                            // }
                            //true 次布
                            // if (temp >= 5) {
                            // if (dataForm.form.actualWeight > 0) {
                            //     //设置定时器 2秒后赋值（当值不为0除外的数字） setTimeout只会执行一次
                            //     if (dataForm.form.timeClothShareWeight == 0 || dataForm.form.timeClothShareWeight == undefined || dataForm.form.timeClothShareWeight == null || dataForm.form.timeClothShareWeight == NaN || dataForm.form.timeClothShareWeight == "") {
                            //         dataForm.form.timeClothShareWeight = dataForm.form.tempWeight
                            //     }
                            // } else {
                            //磅布重量
                            if (dataForm.form.actualWeight == 0 || dataForm.form.actualWeight == undefined || dataForm.form.actualWeight == null || dataForm.form.actualWeight == NaN || dataForm.form.actualWeight == "") {
                                dataForm.form.actualWeight = dataForm.form.tempWeight
                                console.log('重量：', dataForm.form.tempWeight, '磅布重量：', dataForm.form.actualWeight)
                                changeWeight()
                            }
                            // }
                            // temp = 0;
                            WeightAfterInspection()
                            // }
                        }
                    }

                    ws.onclose = function () {
                        console.log("连接关闭！！！")
                    }
                    ws.onerror = function (e) {


                    }

                }

                //点击磅布重量 实际重量赋值磅布重量
                function assignment () {
                    //没勾选次布情况下 且不等于0的情况下
                    if (dataForm.form.tempWeight == undefined || dataForm.form.tempWeight == null || dataForm.form.tempWeight == "") {
                        // dataForm.form.actualWeight = 0
                        dataForm.form.actualWeight = getActualWeightonlybb()
                    } else {
                        if (dataForm.form.tempWeight > getActualWeightonlybb()) {
                            dataForm.form.actualWeight = dataForm.form.tempWeight

                        } else {
                            dataForm.form.actualWeight = getActualWeightonlybb()
                        }
                        WeightAfterInspection()
                        changeWeight()
                        calculateRevolutions()
                    }
                    zjzsChange()
                    checkWeight()
                }

                let showModal = ref(false)
                let showModal1 = ref(false)
                let showModalOP = ref(false)
                let showModalOP1 = ref(false)
                let showModalOP2 = ref(false)
                let showModalMap = ref('')
                let showModalMap1 = ref('')
                let isContinue = ref(false)
                let isContinueXb = ref(false)
                let isContinueJd = ref(false)

                function onConfirm () {
                    getFocus.value.value = ''
                    getFocus.value.focus()
                    showModal.value = false
                    dataForm.form['recordType'] = 2 //复检
                    isContinue.value = true
                    dataForm.type = 2
                    setAllDataToView(AllData)
                }

                function onConfirm1 () {
                    getFocus.value.value = ''
                    getFocus.value.focus()
                    showModal1.value = false
                    inspectNum.value = 0
                    if (clickFlag) {
                        dataForm.type = (dataForm.type == 0 ? 1 : 0)
                        dataForm.form['recordType'] = dataForm.type
                        initializeData()
                        clickFlag = false
                        postNumList()
                        return
                    }
                    // 如果现在是复检2操作 要新标的话 默认回到 初检0  反之 如果是初检 0 或者抽检 1  则不用修改状态
                    dataForm.type = (dataForm.type == 2 ? 0 : dataForm.type)
                    dataForm.form['recordType'] = dataForm.type
                    if (AllData.open == 1) {
                        showModal.value = true
                        dataId = AllData.scannedGreyCloth['id']
                    } else {
                        setAllDataToView(AllData)
                    }
                    postNumList()
                }

                function onCancel () {
                    getFocus.value.value = ''
                    getFocus.value.focus()
                    showModal.value = false
                    isContinue.value = false
                    postNumList()
                    initializeData()
                }

                function postNumList () {
                    if (dataForm.form.client) {
                        post({
                            url: "/qms/DecimalFormat/getBrandDecimalNum",
                            data: { brandName: dataForm.form.client },
                        }).then((res) => {
                            if (res.code == 200) {
                                if (res.data == 0) {
                                    pageData.decimalNum = 2
                                } else {
                                    pageData.decimalNum = res.data
                                }
                            } else {
                                pageData.decimalNum = 2
                            }
                        }).catch(console.log).finally(() => {
                        })
                    } else {
                        pageData.decimalNum = 2
                    }
                }

                function onCancel1 () {
                    getFocus.value.value = ''
                    getFocus.value.focus()
                    showModal1.value = false
                    postNumList()
                }

                function onCancel2 () {
                    showModalOP.value = false
                    copyPost(showModalMap.value)
                }

                //删除
                function delHandler () {
                    //判断布飞是否验布过
                    if (dataId != undefined || dataId != "" || dataId != null) {
                        post({
                            url: 'qms/scannedGreyCloth/deleteById',
                            data: {
                                "id": dataId
                            }
                        }).then(res => {
                            if (res.code == 200) {
                                Message.success({
                                    content: '删除成功！',
                                    duration: 5000,
                                })
                                initializeData()

                            } else {
                                Message.error({
                                    content: res.message,
                                    duration: 5000,
                                })
                            }
                        })
                    }
                }

                const casOb = ref()
                const casOb1 = ref()
                //公司改变
                const cascaderChange = (event, val, num) => {
                    pageData.bmList = []
                    // pageData.ygPopId = null
                    pageData.departmentId = null
                    pageData.department = ""
                    pageData.firmName = ""
                    if (num == 0) {
                        pageData.empPopList = []
                        pageData.ygPopId = null
                    }
                    //拿到选中的这个节点数组
                    setTimeout(function () {
                        if (casOb.value.selectViewValue.length != 0) {
                            if (casOb.value.selectViewValue[0]['label'].includes('/')) {
                                let arrayFrim = casOb.value.selectViewValue[0]['label'].split('/')
                                pageData.title = arrayFrim[arrayFrim.length - 1]
                                pageData.firmName = arrayFrim[arrayFrim.length - 1]
                            }
                            pageData.companyIdList = casOb.value.selectViewValue[0]['value'].split('-')
                        }
                    }, 100)
                    if (val == '' || val == undefined) {
                        pageData.employeeId = null
                    } else {
                        pageData.isShow = false
                    }
                    getBmGroup(val)
                    // ygselect('')
                }
                //部门改变
                const cascaderChange1 = (val, num) => {
                    pageData.department = ""

                    //拿到选中的这个节点数组
                    setTimeout(function () {
                        if (casOb1.value.selectViewValue.length != 0) {
                            if (casOb1.value.selectViewValue[0]['label'].includes('/')) {
                                let arrayFrim = casOb1.value.selectViewValue[0]['label'].split('/')
                                pageData.title1 = arrayFrim[arrayFrim.length - 1]
                                pageData.department = arrayFrim[arrayFrim.length - 1]
                            }
                        }
                    }, 100)
                    if (val != null && val != undefined && val != "" && val != 0) {
                        if (num == 0) {
                            pageData.empPopList = []
                            pageData.ygPopId = null
                            ygselect(val)
                        }
                    }
                }

                async function ygselect (v) {
                    pageData.loading = true
                    pageData.loading1 = true
                    post({
                        url: 'org/hrEmployee/getPage',
                        data: {
                            deleteState: 0,
                            obsoleteState: 0,
                            company_id: pageData.firmGroupId == '' ? undefined : pageData.firmGroupId,
                            department_id: v == '' ? undefined : v,
                            ygText: "",
                            page: 1,
                            size: 200
                        },
                    })
                        .then((res) => {
                            if (res.code === 200) {
                                pageData.empPopList = res.data
                            }
                        })
                        .finally(() => {
                            pageData.loading = false
                            pageData.loading1 = false
                        })
                }

                const focuss = (val) => {
                    // if (val == '' && pageData.empPopList.length > 0) {
                    //     return;
                    // }
                    pageData.loading2 = true
                    post({
                        url: 'org/hrEmployee/getPage',
                        data: {
                            deleteState: 0,
                            obsoleteState: 0,
                            company_id: verifyCompanyIdList[0].companyId == undefined ? '' : verifyCompanyIdList[0].companyId,
                            department_id: pageData.departmentId == '' ? undefined : pageData.departmentId,
                            ygText: val,
                            page: 1,
                            size: 30
                        },
                    })
                        .then((res) => {
                            if (res.code === 200) {
                                pageData.empPopList = res.data.list
                            }
                        })
                        .finally(() => {
                            pageData.loading2 = false
                        })
                }
                const changess = () => {
                    pageData.firmGroupId = null
                    pageData.departmentId = null
                    pageData.firmGroupName = ''
                    pageData.departmentName = ''
                    let oa = null // 公司id
                    let ob = null // 部门id
                    pageData.empPopList.forEach(item => {
                        if (pageData.ygPopId == item.id) {
                            // oa = item.companyId
                            // ob = item.departmentId
                            pageData.firmGroupId = item.companyId
                            pageData.departmentId = item.departmentId
                            pageData.firmGroupName = item.companyName
                            pageData.departmentName = item.departmentName
                            console.log(pageData.firmGroupId)
                            console.log(pageData.departmentId)
                            console.log(pageData.firmGroupName)
                            console.log(pageData.departmentName)
                        }
                    })
                    // cascaderChange('', oa, 1)
                    // cascaderChange1(ob, 1)
                    // pageData.firmGroupId = oa;
                    // pageData.departmentId = ob;

                }
                // 获取公司列表
                const getFirmGroup = () => {
                    post({
                        url: 'org/baCompany/getTreeCompanyOrDepartment',
                        data: {},
                    }).then((res) => {
                        if (res.code === 200) {
                            pageData.firmGroupList = res.data
                        }
                    })
                }
                // 获取部门列表
                const getBmGroup = (val) => {
                    post({
                        url: 'org/baCompany/getDepartmentTree?companyId=' + val,
                    }).then((result) => {
                        if (result.code === 200) {
                            pageData.bmList = result.data
                        }
                    })
                }

                function clickDeleteRow (record) {
                    let delOb = record.checkStaffCode + record.defectName
                    dataForm.ckList = dataForm.ckList.filter(function (o) {
                        let ckOb = o['checkStaffCode'] + o['defectName']
                        return delOb != ckOb
                    })
                }

                //复检按钮
                function ReInspesction () {
                    showModal.value = false
                }

                //拿到员工id 获取权限
                function getPermissionByEmpIds () {
                    pageData.ClothInspectionauthority = {}
                    let list = pageData.ygCodeList.map(function (o) {
                        return parseInt(o['empId'])
                    })
                    post({
                        url: 'admin/acl/permission/getPermissionByEmpIds',
                        data: list
                    })
                        .then((res) => {
                            console.log(res)
                            if (res.code === 200) {
                                let data = res.data.list
                                if (data.includes('yb.bc')) {
                                    pageData.ClothInspectionauthority['bc'] = true
                                }
                                if (data.includes('yb.xb')) {
                                    pageData.ClothInspectionauthority['xb'] = true
                                }
                                if (data.includes('yb.jd')) {
                                    pageData.ClothInspectionauthority['jd'] = true
                                }
                                if (data.includes('yb.cj')) {
                                    pageData.ClothInspectionauthority['cj'] = true
                                }
                                if (data.includes('yb.fj')) {
                                    pageData.ClothInspectionauthority['fj'] = true
                                }
                                if (data.includes('yb.zjytj')) {
                                    pageData.ClothInspectionauthority['zjytj'] = true
                                }
                                if (data.includes('yb.zjysc')) {
                                    pageData.ClothInspectionauthority['zjysc'] = true
                                }
                                if (data.includes('yb.cbgxk')) {
                                    pageData.ClothInspectionauthority['cbgxk'] = true
                                }
                                if (data.includes('ybls.cx')) {
                                    pageData.ClothInspectionauthority['cx'] = true
                                }
                                if (data.includes('yb.bb')) {
                                    pageData.ClothInspectionauthority['bb'] = true
                                }
                                if (data.includes('ybls.dc')) {
                                    pageData.ClothInspectionauthority['dc'] = true
                                }
                            }
                        })

                }

                var clickFlag = false

                function clickType () {
                    if (pageData['ClothInspectionauthority']['cj']) {
                        if (dataForm.form.clothfiyCode != undefined && dataForm.form.clothfiyCode != null && dataForm.form.clothfiyCode != '') {
                            clickFlag = true
                            showModal1.value = true
                            return
                        }
                        if (dataForm.type == 0) {
                            dataForm.type = 1
                            getFocus.value.focus()
                        } else {
                            dataForm.type = 0
                            getFocus.value.focus()
                        }

                    } else {
                        Message.warning({
                            content: '您没有权限！',
                            duration: 5000,
                        })
                    }

                }

                let paramOb = {}

                function lsBfChange (code) {
                    paramOb['clothfiyCode'] = ''
                    paramOb['barCode'] = ''
                    if (code == '') {
                        return
                    }
                    if (pageData['ClothInspectionauthority']['cx']) {
                        paramOb = {}
                        if (pageData.clothCode.indexOf('{') != -1) {
                            pageData.clothCode = JSON.parse(code)
                            paramOb['clothfiyCode'] = code.clothfiyCode
                        } else {
                            paramOb['barCode'] = code
                        }
                        page.value = 1
                        cxLine()
                    } else {
                        Message.warning({
                            content: '您没有权限！',
                            duration: 5000,
                        })
                    }

                }

                //计算次布转数 个人次布重量/个人重量*个人转数
                function calculateRevolutions () {
                    dataForm.yg.forEach(function (o) {
                        if (o['fabricWeight'] != 0 && o['fabricWeight'] != "" && o['fabricWeight'] != null && o['fabricWeight'] != undefined && o['checkWeight'] != 0 && o['checkWeight'] != "" && o['checkWeight'] != null && o['checkWeight'] != undefined && o['checkRevolution'] != 0 && o['checkRevolution'] != "" && o['checkRevolution'] != null && o['checkRevolution'] != undefined) {
                            o['defectiveRevolutions'] = (o['fabricWeight'] / o['checkWeight'] * o['checkRevolution']).toFixed(0)
                        } else {
                            o['defectiveRevolutions'] = 0
                        }
                    })
                }

                const changessssw = (e) => {
                    dataForm.form.perchingGradeRemark = e.join(',')
                }
                const concatClothVisible = ref(false)
                const concatClothTableData = ref([])
                const ybRowIndex = ref(0)
                const selectedRowKeyconcatCloth = ref([])
                const isNNull = (num) => {
                    return num !== undefined && num !== null && num !== ''
                }
                const concatCloth = () => {
                    concatClothVisible.value = true
                }

                const createGetWeight = (key, type) => {
                    return () => {
                        const sumWeight = dataForm.yg.reduce((acc, currentValue) => {
                            if (currentValue['refuteClothState'] === type) {
                                return acc + Number(currentValue[key])
                            }
                            return acc + 0
                        }, 0)
                        const fixedNum = customRound(sumWeight, pageData.decimalNum)
                        return Number(fixedNum)
                    }
                }
                // 获取磅布重量排除驳布的数据
                const getActualWeightNobb = createGetWeight('checkWeight', 0)
                const getActualWeightonlybb = createGetWeight('checkWeight', 1)
                // 获取次布重量排除驳布的数据
                const getcbWeightNobb = createGetWeight('fabricWeight', 0)
                const getcbWeightonlybb = createGetWeight('fabricWeight', 1)
                const concatClothSure = () => {
                    if (concatClothTableData.value.length == 0) {
                        Message.error({
                            content: '请添加员工再保存',
                            duration: 2000
                        })
                        return
                    }
                    const isAllNNull = concatClothTableData.value.some(item => isNNull(item.checkWeight) && isNNull(item.checkRevolution) && isNNull(item.fabricWeight))
                    if (!isAllNNull) {
                        Message.error({
                            content: '填入数据不可为空，请检查！',
                            duration: 5000
                        })
                        return
                    }
                    const oldTimeClothShareWeight = Number(dataForm.form.timeClothShareWeight) - getcbWeightonlybb()
                    dataForm.yg.unshift(...concatClothTableData.value)
                    const sumWeight = dataForm.yg.reduce((acc, currentValue) => {
                        return acc + Number(currentValue['checkWeight'])
                    }, 0)
                    dataForm.form.actualWeight = customRound(sumWeight, pageData.decimalNum)
                    const sumcbWeight = oldTimeClothShareWeight + getcbWeightonlybb()
                    dataForm.form.timeClothShareWeight = customRound(sumcbWeight, pageData.decimalNum)
                    concatClothTableData.value = []
                    concatClothVisible.value = false

                }

                const concatClothNumChange = (row) => {
                    if (row.fabricWeight > row.checkWeight) {
                        row.fabricWeight = row.checkWeight
                    }
                    if (isNNull(row.checkWeight) && isNNull(row.checkRevolution) && isNNull(row.fabricWeight)) {
                        row.defectiveRevolutions = row.fabricWeight / row.checkWeight * row.checkRevolution
                    } else {
                        row.defectiveRevolutions = 0
                    }
                    row.defectiveRevolutions = row.defectiveRevolutions.toFixed(0)
                }
                const concatClothdelLine = () => {
                    if (selectedRowKeyconcatCloth.value.length === 0) {
                        Message.error({
                            content: '请先勾选',
                            duration: 5000
                        })
                        return
                    }
                    concatClothTableData.value = concatClothTableData.value.filter(function (o) {
                        console.log(selectedRowKeyconcatCloth.value, o.ybRowIndex)
                        return !selectedRowKeyconcatCloth.value.includes(o.ybRowIndex)
                    })
                    selectedRowKeyconcatCloth.value.length = 0
                }
                //保留decimalPlaces位小数函数，num是原始值，decimalPlaces是保留的位数
                const customRound = (num, decimalPlaces) => {
                    const factor = Math.pow(10, decimalPlaces)
                    return (Math.round(num * factor + Number.EPSILON) / factor).toFixed(decimalPlaces)
                }
                //次布不能大于磅布重量
                const checkWeight = () => {
                    let actualWeight = Number(dataForm.form.actualWeight)  //磅布重量
                    let timeClothShareWeight = Number(dataForm.form.timeClothShareWeight)   //次布重量
                    if (timeClothShareWeight > actualWeight) {
                        dataForm.form.timeClothShareWeight = dataForm.form.actualWeight

                    }
                }
                //值机重量不能大于次布重量
                const checkygWeight = () => {
                    console.log(dataForm.yg, "dataForm.yg")
                    if (dataForm.yg) {
                        dataForm.yg.forEach((item) => {
                            let checkWeight = Number(item.checkWeight)  //值机重量
                            let fabricWeight = Number(item.fabricWeight)  //次布重量
                            if (checkWeight < fabricWeight) {
                                item.fabricWeight = Number(item.checkWeight)
                            }
                        })
                    }
                }

                const lastTimeWeight = ref(0)
                const focusOfCB = (record) => {
                    lastTimeWeight.value = getcbWeightonlybb()
                }
                const getygRevolutionsOnlybb = createGetWeight('checkRevolution', 1)
                const computedTotalRevolutions = computed(() => {
                    return dataForm.totalRevolutions + getygRevolutionsOnlybb()
                })
                return {
                    getygRevolutionsOnlybb,
                    computedTotalRevolutions,
                    tableColumnsBB,
                    lastTimeWeight,
                    focusOfCB,
                    isNNull,
                    checkWeight,
                    createGetWeight,
                    getcbWeightNobb,
                    getActualWeightonlybb,
                    getcbWeightonlybb,
                    checkygWeight,
                    getActualWeightNobb,
                    concatClothVisible,
                    concatClothTableData,
                    concatClothNumChange,
                    selectedRowKeyconcatCloth,
                    concatClothdelLine,
                    customRound,
                    changessssw,
                    inspectNum,
                    cxLine1,
                    lsBfChange,
                    clickType,
                    ReInspesction,
                    clickDeleteRow,
                    getBmGroup,
                    getFirmGroup,
                    cascaderChange1,
                    cascaderChange,
                    casOb,
                    casOb1,
                    changess,
                    isContinue,
                    isContinueXb,
                    isContinueJd,
                    delHandler,
                    onCancel,
                    onCancel1,
                    onCancel2,
                    onCancel3,
                    onCancel4,
                    onCancel5,
                    onCancel6,
                    showModalMap,
                    showModalMap1,
                    onConfirm,
                    onConfirm1,
                    showModal,
                    showModal1,
                    showModalOP,
                    showModalOP1,
                    showModalOP2,
                    blurYg,
                    assignment,
                    delLine,
                    zjzsChange,
                    popYgData,
                    getFirmGroup,
                    // getYgName,
                    visibleYg,
                    handleOkYg,
                    handleCancelYg,
                    fullScreen,
                    total,
                    page,
                    size,
                    postNumList,
                    PageSize,
                    change1,
                    visibleXq,
                    handleClickXq,
                    handleOkXq,
                    handleCancelXq,
                    tableColumnsCd,
                    tableColumnsJhd,
                    changeHcb,
                    // changeStaff,
                    addYg,
                    zsBlur,
                    getPeopleList,
                    getUrlSearch,
                    scroll,
                    oaNumber,
                    scrollbar,
                    tablediv,
                    loginForm,
                    login,
                    sideOk,
                    formRef,
                    dataForm,
                    viewHistory,
                    selectedRowKeys,
                    tableColumns,
                    // tableColumnsJhd,
                    // tableColumnsCd,
                    copyPost1,
                    tableColumnsYg,
                    copyPost,
                    tableColumnsCk,
                    pagination,
                    table,
                    rowKey,
                    pageData,
                    options,
                    loading,
                    handleSearch,
                    options1,
                    loading1,
                    handleSearch1,
                    focusSel1,
                    isChiese,
                    focusSel,
                    s: selectedRowKeysJhd.selectedRowKeys,
                    s1: selectedRowKeysCd.selectedRowKeys,
                    selectedRowKeysYg,
                    // z1: selectedRowKeysCk.selectedRowKeys,
                    selectedRowKeysCk,
                    visible,
                    handleBeforeOk,
                    getFocus,
                    handleCancel,
                    // clickTag,
                    // visible1,
                    // handleBeforeOk1,
                    // handleCancel1,
                    isShow,
                    changeTm,
                    openPop,
                    // closeHandler,
                    saveHandler,
                    saveHandler1,
                    clickName,
                    defectName,
                    focuss,
                    cxLine,
                    changeClothWarehouse,
                    dcLine,
                    editHandler,
                    focusDl,
                    changeCb,
                    changeYg,
                    ygCodeOb,
                    clickDel,
                    getRemark,
                    clickCbZl,
                    cbWeight,
                    ruCbc,
                    cbcCheck,
                    materialProblem,
                    materialProblem1,
                    send,
                    concatCloth,
                    concatClothSure,
                    ybRowIndex

                }

            }
        })
        app.use(ArcoVue)
        app.mount('#app')

    </script>
</body>

</html>